Page Forwarding Question

2000-12-20 Thread James Howe

In my action classes I have code which checks to see if a user has logged 
on.  If not, the code forwards to the logon page (e.g. 
servlet.findForward("logon")).  However this doesn't fully accomplish what 
I would like.  If a user attempts to reference a page which requires a 
login, I would like to forward to the login page and, once the user has 
authenticated, proceed back to the page to which the user was going in the 
first place.  In other words, I would like to forward to the logon screen, 
but give it a parameter which it uses to tell it which page follows the 
logon.Can anyone suggest a simple way to accomplish this?

Thanks.




RE: Page Forwarding Question

2000-12-20 Thread Sayles, Scott SAXONHQ

Have the login page write a hidden field with the value of the requested url
and submit it to your logon action.  From your logon action you can then
instantiate a new ActionForward and set the path to the requested url, as
defined in the hidden form field, and return that.  Alternatively, instead
of instantiating a new ActionForward you could just use the request
dispatcher and forward with it and then return a null to the ActionServlet.

I'm using a similar method now but exapanded it so that all request
parameters are written as hidden fields in the login form as well.  That
way, the previous form results can be submitted along with the login request
(and then on to the subsequent page or action).

Hope this helps.

 -Original Message-
 From: James Howe [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 20, 2000 10:06 AM
 To: [EMAIL PROTECTED]
 Subject: Page Forwarding Question
 
 
 In my action classes I have code which checks to see if a 
 user has logged 
 on.  If not, the code forwards to the logon page (e.g. 
 servlet.findForward("logon")).  However this doesn't fully 
 accomplish what 
 I would like.  If a user attempts to reference a page which 
 requires a 
 login, I would like to forward to the login page and, once 
 the user has 
 authenticated, proceed back to the page to which the user was 
 going in the 
 first place.  In other words, I would like to forward to the 
 logon screen, 
 but give it a parameter which it uses to tell it which page 
 follows the 
 logon.Can anyone suggest a simple way to accomplish this?
 
 Thanks.
 



RE: Page Forwarding Question

2000-12-20 Thread Shiraz Wasim Zaidi

 In my action classes I have code which checks to see if a user has logged
 on.  If not, the code forwards to the logon page (e.g.
 servlet.findForward("logon")).  However this doesn't fully
 accomplish what
 I would like.  If a user attempts to reference a page which requires a
 login, I would like to forward to the login page and, once the user has
 authenticated, proceed back to the page to which the user was
 going in the
 first place.  In other words, I would like to forward to the
 logon screen,
 but give it a parameter which it uses to tell it which page follows the
 logon.Can anyone suggest a simple way to accomplish this?

I think you might have problem using this approach if the session expires.

Let's say that a user's session expires due to time out and ur referenced
page relies on session data.
User was on Order List screen showing a list of orders. He goes for coffee
comes after an
hr. and session expires. He tries to view next page of Order List and in ur
action or JSP you detect
login required and forward to loginPage with somehow indicating to show
OrderList page after authentication.
Now ur OrderList jsp would be looking for session data to render the view
and it wont find anything as the
session is new.

What do you think?


-Shiraz