Rick,

  Let me mention something. One potential problem with this approach is 
that by the time the action is called, may be too late. You really need to 
catch this earlier. I had implemented something along these lines awhile 
back and soon remembered that the ActionForm is populated and the 
validate() method is called, all of this before the Action's execute() 
method is invoked. The question is, do you want to check whether or not the 
user is logged in after this, or before it. Maybe this is app specific, I'm 
not sure. It's my opinion, and only an opinion, that you really should be 
catching this before the action is invoked, if nothing else, for security 
reasons.

What I suggest is to look at the processPreprocess() method in the 
RequestProcessor and possibly override this to do your checks. It's called 
for every request and long before ActionForm's are populated and Action's 
are invoked. The default value is to return true, which allows request 
processing to continue. What I've done in the past is to override this, 
check the login, and possibly redirect the user to the login page. If the 
user's logged in, just return true to continue processing the request.

Just some things to think about,
Chuck

At 09:31 PM 6/3/2002 -0400, you wrote:
>On Friday, May 31, 2002, 7:11:47 AM, Ted Husted wrote:
>
>TH> The Struts Dispatch Action is designed to do exactly the same thing, but
>TH> without messy branching logic. The base perform method will check a
>TH> dispatch field for you, and invoke the indicated method. The only catch
>TH> is that the dispatch methods must use the same signature as perform.
>TH> This is a very modest requirement, since in practice you usually end up
>TH> doing that anyway.
>
>     Ted, I was discussing with James Mitchell about ways to manage a
>     user being logged in and he suggested a way that I really liked
>     where you have a base class perform method handle checking the
>     login status and then call something like a doWork() method that
>     will invoke the work in your subclass Actions (avoiding have to
>     have all your actions handle the loggin check).
>
>     The question I have is I'm now using a dispatch action class that
>     handles most of the action work. Do I need to go in and modify the
>     base DispatchAction class' perform method in order to get
>     something similar to the above functionality? Or maybe there is an
>     easier way to handle checking login status using a subclass of
>     DispatchAction?
>
>     Thanks
>
>--
>
>Rick
>
>mailto:[EMAIL PROTECTED]
>
>"Probably the earliest flyswatters were nothing more than some sort of
>striking surface attached to the end of a long stick."
>   -Jack Handey
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


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

Reply via email to