I have been using the following for returning the user to their intended
URL after a login, and have had good luck with it ...
----- In the Base Action class -----
if (someCheckFor.loggedInUser() == null) {
StringBuffer goToPath = new StringBuffer(request.getServletPath());
if (request.getQueryString() != null) {
goToPath.append("?" + request.getQueryString()); }
request.setAttribute("userPath", goToPath.toString());
return mapping.findForward("login");
}
----- In the LoginSetup Action -----
loginForm.setPreviousAction((String)request.getAttribute("userPath"));
----- In the Login.jsp -----
<html:hidden property="userPath"/>
----- In the LoginSave Action -----
if ((loginForm.getUserPath() != null) &&
((loginForm.getUserPath().length()) > 0)) {
return new ActionForward(loginForm.getUserPath());
}
You can change the last line "return new ActionForward" to be a redirect.
Hope that helps,
Susan
On 11/17/2003 07:36:48 AM Adam Hardy wrote:
> On 11/17/2003 05:29 AM Craig Edwards wrote:
> > To complete process X, the user has to perform 5 steps. The user can
> > perform steps 1, 2 and 3 with or without being logged on, but they must
> > be logged on to perform steps 4 and 5. Obviously, I can have a
specific
> > check in step 4, but I would like, say, easily change the logon
> > requirement to instead be in step 3. Basically, I would like to be
able
> > to specify for each page whether the user has to be logged in.
> >
>
> Craig,
> I thought about this myself for implementing more or less the same
> thing, and decided but haven't yet tried saving the user's ActionForm
> that has all the request parameters already.
>
> I would put it in the session under a particular key, and then check
> whether the key contains a valid form at the start of each action, and
> if so, i.e. after the login & redirect back to the originally requested
> destination, take the ActionForm out of the session and overwrite the
> new one.
>
> bear in mind I haven't tried it so there might be some gotcha lurking
> there to prevent this from working.
>
> HTH
> Adam
>
> --
> struts 1.1 + tomcat 5.0.12 + java 1.4.2
> Linux 2.4.20 RH9
>
>
> ---------------------------------------------------------------------
> 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]