I populate a bean with the data in the Action class and store the bean in a request scope attribute. I like to keep the Form as clean and small as I can. I usually use the same form for multiple jsp's so I don't need the clutter of all of the collections of stuff in the Form.
Just My Opinion! :-) -----Original Message----- From: K.C. Baltz [mailto:[EMAIL PROTECTED] Sent: Friday, September 19, 2003 5:16 PM To: Struts Users Mailing List Subject: Re: Action Form Design Question Personally, I've tried to stay away from putting data in the ActionForm that isn't related to an actual form submission value. So if I have a drop down with a list of countries for the user to choose, the list of countries goes into the request attributes and the single choosen country value goes into the ActionForm. That way, you don't need to repopulate the Country List when the user submits their form, something you might have to do if you put the list into the ActionForm. This is just what has worked for me. I've definitely struggled with where to put data and I'm going to be curious to see other replies to your question. K.C. Michael Thompson wrote: > I've hit a stumbling block and I'm not quite sure how to work around > it. I've written struts apps in the past and I've taken the approach > of putting everything in the ActionForm so that the jsp has a one stop > shop for all it's display needs. So where I've hit an issue is when > say I have jsp A that is rendered with form A. When user submits data > to action A, the ActionForm pushed to execute is form A. What happens > when I need to forward from action A to jsp B which is rendered with > form B? I need to populate an ActionForm B to send to jsp B, but I > don't have one. Is it "normal" to create a form of a different type > in your Action? So essentially the code would look something like: > > public ActionForward execute(ActionMapping mapping, ActionForm form, > HttpServletRequest request, HttpServletResponse response) > throws Exception > { > FormA inputForm = (FormA)form; > Result result = doSomeCrunchingOnDataSubmittedViaFormA(inputForm); > FormB outputForm = getInstanceOfFormB(mapping, request); //this > would stash in request/session also > populateFormBWithResults(outputForm, result); > > return mapping.findForward("success"); > } > > getInstanceOfFormB is a little hazy, but I did notice a method in > RequestUtils that might help. Seems like this might be breaking some > struts abstractions by knowing what form to create etc. > > Is this the correct way to approach this or should I think about a > redesign of my forms and actions? Thanks in advance! > --m > > > > --------------------------------------------------------------------- > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]