struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Taylor" <>
Subject RE: Action Form Design Question
Date Sat, 20 Sep 2003 10:53:50 GMT
This was discussed earlier this week. 

Some solutions are addressed here:


> -----Original Message-----
> From: Michael Thompson []
> Sent: Friday, September 19, 2003 6:10 PM
> To: struts-user
> Subject: Action Form Design Question
> 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:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message