Christopher Schultz wrote: > Philippe, > > Pille wrote: >> 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) > >> after submitting the form with wrong parameters and returning to the >> page the beans are gone. is there any possibility to set the beans with >> request.setAttribute() again? > > You are encountering a common problem with a simple solution. In order > to display the form the first time, you are loading "extra" data such as > the list of countries. When validation fails, Struts will send you back > to the "input" page to try again. If your "input" page is just your > form, you will be missing that "extra" information. > > What I usually do is create two actions: one that loads the information > to be edited (the actual content of the form) and another to "prepare" > the display. This "prepare" action loads this "extra" information such > as a country list. > > So, I'd have something like this: > > <action path="/edit" type="EditAction" name="MyFormBean"> > <forward name="success" path="/prepare.do" /> > </action> > <action path="/prepare" type="LoadExtraInfoAction" name="MyFormBean"> > <forward name="success" path="/edit.jsp" /> > </action> > <action path="/save" type="SaveAction" name="MyFormBean" > validate="true" input="/prepare.do"> > <forward name="success" ... /> > </action> > > As you can see, the "input" for SaveAction is now set to the "prepare" > action which loads that extra information, so it's available for the > form in case any validation errors occur. > > -chris
ok. i understand. how can i set a property of the form, that is used and needed in the jsp of the form after editing? how can i set a property of a dyna form from within an action? how do i make sure that this property will be still set after submission and redirecting over 2 sites? the problem is that i have 4 dynamic combo boxes and i always need to iterate over the request parameters with a Regexp to get and reset all the parameters of the combo boxes. the contents of the 4 combo boxes depend on the previously made selection. one row of the combo boxes is hold in an ArrayList which is a property of the DynaValidatorForm. the ArrayList itself holds the Beans. after making a selection in the last combo box, i call the action and add a new element in the array list. in the jsp i iterate over this ArrayList and a second line with no selection is displayed. for each combo box i submit the form with the javascript onchange event to generate new values (or maybe a new row with combo boxes). i have one row of 4 combo boxes. after a selection in the last combo box of the last row i create a new arraylist item and a new line with new combo boxes is displayed. the selection possibilities are stored in the bean (ArrayList with Beans) too because some selection possibilities are different from others e.g. in the third combo box in the first row there are different selection values than in the third combo box in second row because of different selections in second combo in first and second row. difficult to explain, sorry, hope you understand. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

