Save mapping in session and go to login page:
session.setAttribute(REDIRECT_KEY, mapping);
return mapping.findForward("login");
In your login action, check if a mapping is in the session and go there:
ActionMapping redirectMapping =
(ActionMapping) session.getAttribute(REDIRECT_KEY);
if (redirectMapping != null) {
session.removeAttribute(REDIRECT_KEY);
return new ActionForward(redirectMapping.getInput());
}
Reinhard
Rick Mann wrote:
>on 5/28/02 11:59 PM, Adam Hardy at [EMAIL PROTECTED] wrote:
>
>
>
>>I wouild save the form bean and a mapping or action forward in the
>>session, and collect them when the in-between task is finished.
>>
>>
>
>Yeah, I was thinking of that, too.
>
>Okay, so here's the struts-specific problem: how do I get the name of the
>action in a way that I can use later to generate an ActionForward? If I call
>mapping.getPath(), I get the path used in the mapping, but it will be
>"outside" of the pattern set up in the deployment descriptor. Typically, it
>will not end in ".do".
>
>Right now, I do this:
>
>forward = new ActionForward();
>forward.setContextRelative(true);
>forward.setPath(originalResource + ".do");
>
>This works, but won't work if the original resource was a .jsp. (I'd like to
>put a tag at the top of a JSP to check for a valid login). In fact, it
>doesn't work in the general case (say the deployment action servlet mapping
>is "/action/*" instead of "*.do").
>
>Perhaps I just don't understand container-managed security well enough. How
>can I cause one of my User objects to be created in the session when the
>user gets authenticated? As far as what's provided by the server, it just
>sets a user name (and principal) available to servlets. I suppose I could
>look for the user, and if it's not found, create one based on the result of
>isUserInRole() et al., but it just seems less than elegant. I'll post a more
>general question to the Tomcat list.
>
>
>
>
--
Reinhard N�gele
MGM EDV-Beratung GmbH
Frankfurter Ring 105 a
80807 M�nchen
Tel.: +49 89 358680-817
Fax: +49 89 358680-88
E-Mail: [EMAIL PROTECTED]
Web: www.mgm-edv.de
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>