浏览 1358 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-11-24
最后修改:2010-01-16
Here is my problem: In my action,there is a property List<Peson> persons; now in jsp, I use iterator like below: <s:iterator value= "persons " status= "stat "> <s:textfield label= "%{ 'Person '+#stat.index+ ' Name '} " name= "%{ 'persons[ '+#stat.index+ '].name '} " /> <s:textfield label= "%{ 'Person '+#stat.index+ ' Age '} " name= "%{ 'persons[ '+#stat.index+ '].age '} " /> </s:iterator> I want to validation user input while submit the form, “name" should not empty, and "age" must be number. in my validation config file I write like this: <validators> <field name="persons[].name"> <field-validator type="requiredstring"> <message key="requiredstring" /> </field-validator> </field> <field name="persons[].age"> <field-validator type="short"> <message key="requiredshort" /> </field-validator> </field> </validators> It seems doesn't work. Besides that, I want to add error style to the filed which doesn't pass the validation. In S1,we can use <html:text errorStyle="errorStyle" .../> to achieve this task, but How to do it in S2? 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |