struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Leland <>
Subject Re: Design Questio
Date Sat, 08 Feb 2003 05:34:35 GMT
Justin F. Knotzke wrote:

>     Hi,
>    I am sure this is a basic question.
>    Take a situation in where we have 2 JSPs, 2 ActionForms, and 2
>ActioForward classes:
>    a.jsp
>    b.jsp
>    ActionFormA.class
>    ActionFormB.class
>    ActionForwardA.class
>    ActionForwardB.class
>    a.jsp has form who's action parameter calls ActionForwardA.class
>with ActionFormA.class as it's form object.
>    ActionForwardA.class does some happy-happy stuff and then calls
>	Correct me if I am wrong but b.jsp will be called using
>ActionFormA.class's data. Keeping in mind that ActionForwardA.class
>requires data from ActionFormA.class, what do I do if I want b.jsp to be
>mapped to ActionFormB.class?   
The pattern that the struts example uses is

  EditAAction         SaveAAction ------>EditBAction           SaveBAction
/                                              \            /
/                                                  \         /
/                                                     \/     /
(AActionForm)  + A.jsp                     (BActionForm)+B.jsp

To keep your code maintainable after SaveAAction is 'happy'
It looks up the 'success' or 'happy' mapping in your struts-config.xml
That maps to EditBAction which takes care of filling in the data for
BActionForm, and then forwards to b.jsp.

All this is covered in Ted Husted's 'A Walking tour of the struts example'.
in the resources section of the Struts web site, it is also included in the
'struts-documentation' web application in the binary struts download.
Taking the time to look at that explaination of the 'example' included 
with struts,
look at the code and trace through the program flow, and after some digging
you'll get an AH or two that will be worth it.


P.S. As always there are other articles out there on the Jakarta web 
site/ or Javaworld,
sites to name a few. You can also pickup one of the very good struts books
that have come out.

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

View raw message