Let me give you some very quick pseudo-code that might help you:

In SecureAction execute method:

if (request.getSession().getAttribute("username") == null) {
   String pathInformation = mapping.getPath();
   request.getSession().setAttribute("securedPath",pathInformation);
   request.getSession().setAttribute("stashedFormData",form);
   return mapping.findForward("login");
} else {
   ActionForm stashedForm = form;
   if (request.getSession().getAttribute("stashedForm") != null) {
      stashedForm =
           (ActionForm)request.getSession().getAttribute("stashedForm");
      request.getSession().removeAttribute("stashedForm");
   }
   return run (mapping, stashedForm, request, response);
}

In your Action code related to a successful login:

String pathInfo = request.getSession().getAttribute("securedPath");
ActionForward frwd = new ActionForward();
frwd.setName("no_name");
frwd.setPath(pathInfo);
frwd.setRedirect(true);
return frwd;


This code (roughly) covers the concerns you mention. The 'securedPath' session attribute lets you know which place was originally hit. The 'stashedForm' attribute prevents the form data from being lost on redirect.


-- Jeff

Tim Carr wrote:
Hello Jeff, thanks for your swift reply,

I should have mentioned, I tried roughly what you explained, and came up
stuck at your step #2; how do I "continue processing" ? That implies
transferring control BACK to the place that originally got hit. I
neither know how to determine which place was originally hit (and then
called SecureAction's execute() method), nor how to transfer control to
something else once I know: I believe using redirect isn't an option
since it destroys the ActionForm I have associated with the page, and I
need to keep the form for the action that was supposed to run in the
first place!

Any more ideas?

Thanks,

Tim

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Beal
Sent: November 3, 2004 11:54 AM
To: [EMAIL PROTECTED]
Subject: Re: Logon/Logoff Design Question

2) After a successful login, pull that information out of the session and continue processing. If you stored a single String in your session as I described in step 1, probably your easiest bet is to create a new ActionForward instance, set redirect to true, and put the String you stored in the path attribute.


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



Reply via email to