Validate over a collection of beans inside a bean.
Joined: Feb 23, 2007
Im about to go insane! I have a ValidatorForm called UserDetailsForm ... within that form I have two bean UserAccountDetailsBean and PersonalDetailsBean ... inside the PersonalDetailsBean is a List of EmailAddressBean's and a property of the EmailAddressBean is a public String emailAddress .... How on God's earth can I validate that that property is a valid email and required for every instance of EmailAddressBean contained in the List using validator.xml I have tried so many things Im starting to go mad see code below:
Please can someone tell me if this is even doable ... Ive started to think ive looked around for days for something that just cant be done
If I have not been clear please let me know and I will try to explain in greater or less ambigious terms.
Joined: Feb 15, 2005
Officially, Struts doesn't support validation for indexed properties. However, I have a feeling the following might work:
I'm pretty sure this will at least validate the first element of the collection, but I have had others tell me that it will also validate the other elements as well. I don't have time right now to test it for myself, but if you're willing to be a "guinea pig", give it a try and tell us whether it works for all elements or not.