Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

DynaValidatorForm and request.setAttribute for html:options

DynaValidatorForm and request.setAttribute for html:options

DynaValidatorForm and request.setAttribute for html:options

i have a DynaValidatorForm and a jsp-page to display the form data. in the jsp page i´m using some combo boxes. i have one action class and this action class does all the actions for this single jsp page and it extends MappingDispatchAction class.
to initialize my combo boxes with values i have a prepare function in the action class and i´m using e.g. request.setAttribute("countries", countryNames) to set the bean for html:options. countryNames is an array of Strings.

before i had a DynaActionForm where i havn´t done any validation and everything worked fine. i changed to DynaValidatorForm and added the appropriate settings in struts-config.xml, validator.xml and MessageResources.properties. then i wanted to test the validation. it works fine and i got the proper error messages.
but after submitting the form with wrong input and returning to the jsp-page i get the following exception:

javax.servlet.jsp.JspException: Cannot find bean under name countries at org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:374)

the page is displayed correctly to the first html:options statement. on top of the page i see the error messages of the validator and in tomcat i see the exceptions. after submitting the form with wrong input the validator redirects me back to the form page but then the beans i´ve set with request.setAttribute() are gone.
is there any possibility to set the beans with request.setAttribute() again? what do i have to do?
thank you


RE: DynaValidatorForm and request.setAttribute for html:options

The request for counties is gone.  Reload the list before you display it and you should be good.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close