I have one jsp with two forms (I'll call it FormA and FormB). Each form has it's own form bean and the two forms perform totally different things so I did not combine them into one.
Before the page is loaded, I populate an Arraylist and set it to the form bean for FormB. When the JSP is displayed, the values are displayed in FormB inside a <html ptions> tag (drop down list). The bean property is actually of type java.util.ArrayList.
My problem is when I click the submit button either in FormA or in FormB and the validation results in an error (or anything that causes the page to be reloaded), the page is redisplayed but the values for my drop down lists in FormB are gone.
Most of the examples in the books and in the tutorials for struts online only show a single form for a page.
My questions are : 1. How are multiple forms in a page handled in struts? 2. When the page is reloaded, how can the values for the other form beans be retained?
This doesn't really have anything to do with having more than one form on the JSP but rather the fact that the code that populates the ArrayList and sets the ActionForm property does not get called when you get validation errors. See this thread for a link to a possible solution.