File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts Validations for ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Validations for ArrayList" Watch "Struts Validations for ArrayList" New topic
Author

Struts Validations for ArrayList

Kiran Kumar
Ranch Hand

Joined: Jan 06, 2003
Posts: 91
Hi All,

I know that we can use validation framework for validating form fields (Form bean properties).

But, if I have a form bean property "items" which is an ArrayList collection of some "VO" objects where "VO.getProperty("X")" will give a form bean property, then how can I validate the "items" property?

I don't know how to add an entry in validation.xml for 'items' which is an ArrayList.

Can someone please help me with this?

Thanks,
Kiran


------------<br />SCJP
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

The validation.xml will take whatever values from your html's source.

If your ArrayList is given a max limit, you'll be ok; you just have to list every possibility in the validation.xml.
If it's unlimited, you can't use the validation framework and you'll have to iterate and validate manually in your validate() method.


A good workman is known by his tools.
 
jQuery in Action, 2nd edition
 
subject: Struts Validations for ArrayList
 
Similar Threads
dynamic beans
How to read the value selected in the selectOneMenu tag in the forwarded jsp page
Radio button with a variable size list
Problem With Indexed Property
Problem in setting a value of drop down