I think you have the right idea with option 1.
There's lots of old posts about this fiddly subject - it may take a while to
dig for them. Try looking up workflow.

I posted some of my code a while ago - no-one else seemed to think too much of
it, but I still happily use it.
if you search the archive:-
http://www.mail-archive.com/struts-user%40jakarta.apache.org/
for ChainToPage, & see messages under subject:-
re: How to return to the page that called the action class?

I want to re-work his thing - but I still like it's basic design.
1 -  Replacing the boss & slave get/setAttributes , as I have a general
preference to pass data in value/message objects rather than in HaspMaps.
2 - Better names.
3 - code to handle irregular navigation (old objcts in the session).
cheers - Keith.
PS How many people have written a user list/maint thing? I'd expect there to be
dozens of sites with a demo & the code available. I'm not proud of my code that
does this but I'll mail it to you direct if you want a look. I think it would
help (but be gentle).


--- Robb Nedwick <[EMAIL PROTECTED]> wrote:
> Hi, 
> 
>   My company is evaluating whether or not to introduce Struts into our
> application architecture as part of our next release, and I have a
> relatively simple/stupid question about how best to build the set of
> screens that we're using as part of our evaluation process. 
> 
>  In this example, I have a screen that displays a list of users.  The
> screen needs several request parameters to identify which list of users
> to display.  From this page, the user can go to a separate worksheet to
> add an additional user to the collection, or modify an existing user,
> and when they successfully save the list page for the user collection
> they are modifying is redisplayed with the new data.  The parameters
> for the list page need to be specified at run-time, since they are
> dependent on the selected list and the user logged in.
> 
>   For the list page, I have an action that uses the request parameters
> to get the list of data and add it to the request as an attribute so
> that the JSP can display the data.  For the worksheet page, I've
> implemented a "read" action to get the data (in a modify scenario) and
> then forward to a worksheet page, and a "save" action to process the
> worksheet and save the data to the business tier. 
> 
>   The confusion I'm having comes in when the save action successfully
> processes the request and needs to perform the forward to send the user
> back to the list page.  The list page needs the list of users to be put
> into the request object for it.  The list action looks for the
> additional data it needs to populate the list as request parameters,
> not as attributes, and Struts does not appear to auto-populate
> ActionForm beans from request attributes, just the parameters.  
> 
>   So, which of the options below would appear to make the most sense
> when building a Struts based web app?
>     
>     - have the save action set the additional data as request
> attributes and have the "success" mapping forward to the get list
> action.  The list action will just need to check if it's ActionForm
> object was populated from the request parameters, and if not, get the
> data it needs from the request attributes. 
> 
>     - have the both the "get list" and "save" actions be capable of
> fetching the list data and populating it for the list screen, and have
> the save action's "success" mapping go directly to the list JSP.
>    
>     - build an ActionForward object to do a browser redirect using the
> struts-config.xml mapping to get the URI and then append additional
> parameters to the URI to get to the next page
> 
>    - store the information needed by the list page in the session and
> update it there as well as on the business tier (rather not do that
> since we already overuse the session to keep stuff around,  and I was
> hoping to get the team to become better at keeping session usage down).
> 
> Seems like the first option is the best, but I wanted to make sure I
> wasn't missing anything.
> 
> Thanks for any help/advice.
> 
> Robb Nedwick
> 
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to