But that's no related items validation, I think what should to be done in validation method should be related items check.
anyway, it's also a good idea in my current solution. thank you Burton:handshake: Burton Rhodes wrote: > > I'm my experience it is much easier to implement Validateable in your > action object. That way you can have very complex validation rules. > Also allows you not keep track of another 'validation' file! > > On 11/24/08, EoneZhang <[EMAIL PROTECTED]> wrote: >> >> 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] >> >> > > -- > Sent from my mobile device > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/-Help-%3A-Struts2-List-object-validation-tp20656466p20674269.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]