Hi all... I am using Struts 2.0. Has anyone ever done validation on individual item in java.util.List before?
Say, I have a property List<Customer> customers in my Action, and Customer is defined as: public class Customer{ private String username; // must not be empty private int age; // must be > 0 } In the JSP I have the following: <c:forEach begin="0" end="10" var="i"> <s:textfield key="customers[${i}].username" /> <s:textfield key="customers[${i}].age" /> </c:forEach> How can I enforce using struts validation (preferrably through annotation) so that: - both username and age are compulsory - age must be an integer Secondly, since "age" is of type "int".. when user enter characters (numbers) in the textfield, they get converted to 0 (somehow). How can I prevent this? Thanks in advance! -- Best regards, WiB -------------------