Now I suffer a problem with s2' validation.

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?
-- 
View this message in context: 
http://www.nabble.com/-Help-%3A-Struts2-List-object-validation-tp20656466p20656466.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to