What I have for the foundation of our Struts app:

-----------

SmoAction
        +-void setSource(SmoActionMapping, HttpServletRequest, String key)
        +-ActionForward getSource(SmoActionMapping, String key)

SmoActionMapping
        +-String getSource()

-----------
Step 1: Setting the Source

On SmoAction, I lazy load a Map into the user's session if:
        +-Request has a "source" parameter
        +-else SmoActionMapping.getSource() != null

Then I use the passed String "key" to set the String "value" from either the
request or the mapping.  End Method.

-----------
Step 2: Getting the Source

On SmoAction, I call getSource() with the SmoActionMapping for reference and
the String "key" for lookup.  The reason for not storing the ActionForward
itself is that I would rather have the ActionForward relative to the current
Action being executed, instead of the one that originally set the source
(this is debatable, but it meets our needs). 
        +- If there is a map in the session to look against
        +- use the passed key to find a forward name
        +- if not null, then use the passed ActionMapping to findForward

-----------
Notes:

Variations on this could include allowing a stack to be created for each
key.  So when I call getSource() I get the last value that was set for that
key.

Some of the issues we ran into were storing parameters and resubmitting
forms.  Because we use SessionBeans to preserve state on our crutial areas,
re-requesting an Action would be able to restore the view based on a session
bean and not on parameters.

Jacob Hookom
Senior Analyst/Programmer
McKesson Medical-Surgical
Golden Valley, Minnesota
http://www.mckesson.com

-----Original Message-----
From: Wendy Smoak [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 03, 2003 4:49 PM
To: Struts Users Mailing List
Subject: RE: Disadvantages of Struts?

> I had to do something similar where I keep a Map in the 
> session and allow
> the actionmappings/request specify a source, it's then up to 
> the action code
> to specify what key to store it under.  Then I can later look 
> up the source as a forward.

Care to elaborate?  Do you have a Map of String-String name/value pairs,
or are you putting ActionForwards in the Map?  What do you mean by
'allow the actionmappings/request specify a source'?

I'm not happy with the way I'm doing the and am looking for something
better.  However I tend to get lost in the details and can't step back
and design the whole solution.

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

---------------------------------------------------------------------
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]

Reply via email to