• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Validations for ArrayList

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic