Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DynaValidatorForm and request.setAttribute for html:options

Status
Not open for further replies.

PillePalle23

Programmer
Dec 17, 2006
1
DE
hi,
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:eek:ptions. 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:eek:ptions 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

greetz
philippe
 
The request for counties is gone. Reload the list before you display it and you should be good.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top