This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have ran into a wall on this problem: I have a form that has several properties that are an array of Strings.
In my JSP I am creating controls associated with each element of the array by looping through the array.
I am trying to use validation.xml to check that the fields all have values.
When I try to submit the form and the validation runs I am getting: "Error 500: The field named 'customerCity' was not defined for form 'CustomerForm' in the validation configuration. "
If I define each element of the array in validation.xml it works fine.
I am trying to keep the number of customers that a user can enter dynamic so that he/she can choose how many to work per submission. I realize that I can do all of this validation easily in the forms validate method, but I was hoping to take advantage of the client side validation that is provided when using struts validation.
Any help that can be offered is greately apprecited, even if it is simply telling me that this can not be done.
IIRC there's no direct support for doing collection-based validation with a single config in either client-side or XML-based config. You could try using a wildcard for the index, but I doubt it will work (although it's hard for me to keep the frameworks straight anymore).
Joined: Apr 03, 2009
That is what I thought. I will just do the validation server side.