DynaValidatorForm and request.setAttribute for html:options
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Philippe_Trolliet
Posted On:   Sunday, December 17, 2006 03:48 PM

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: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 t   More>>

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: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 get the 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 arror 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    <<Less
About | Sitemap | Contact