Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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 ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

optionsCollection issue with DynaValidatorForm

Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a jsp page that has a combo box that is populated with a optionsCollection tag. The collection is a bean property that is an ArrayList of objects. For example, I have the following jsp snippet:

..where customerto is a bean that contains an ArrayList of termcode objects (termcodes) that have the String property of termcode.

Everything displays fine, but if the form fails validation, the collection is not being saved to the DynaValidatorForm bean and hence generates an error that states:

Here's how I have it defined in my struts-config.xml file:

Does anyone have any advice for me on how to get the DynaValidatorForm bean to accept a collection and pass it to my jsp error page?

I hope I stated my question clearly!

Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like the problem here is that there is a discrepancy between how you've defined your form bean and the data you've actually populated it with. You've defined termCodes as a string array, yet you've populated it with an ArrayList. To fix this, just change the definition:

[ September 16, 2007: Message edited by: Merrill Higginson ]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic