The easiest way to do this is to use form-based authentication.  With this
container-managed mechanism, you can declare your protected resources and the
roles that can access them in your web.xml file.  Very slick once you get it
working.

A tutorial can be found at
http://www.onjava.com/pub/a/onjava/2001/08/06/webform.html

Matt

--- Rajeev Singh <[EMAIL PROTECTED]> wrote:
> Stefano,
> You can always store the LastRequestedURL somewhere either in session or
> some other application scope object or also in query string. After login
> is done the user can be redirected/forwarded to this LastRequestedURL.
>   For this there is a catch that you have to choose whether u create the
> session only after login or after once the first request goes to
> controller.
>   Query string is a best possible idea as you don't have to create
> session before login is done. This choice depends upon your
> architecture.
>   e.g. when a request for B is submitted from A, user is redirected to
> login page in following,
>    response.sendRedirect("./login.jsp?lastRequestedURL=B");
> 
> and when login is done create a request dispatcher object on request
> parameter lastRequestedURL , then forward the request to this page.
> 
> Thanx,
> Rajeev
> 
> -----Original Message-----
> From: Stefano Mancarella [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, December 04, 2001 2:56 PM
> To: 'Struts Users Mailing List'
> Subject: Re: Smart login page
> 
> ----- Original Message -----
> From: "Darryl Nortje" <[EMAIL PROTECTED]>
> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> Sent: Tuesday, December 04, 2001 10:21
> Subject: RE: Smart login page
> 
> 
> > You have two pages A, and B. Flow goes from A to B. Inbetween going
> from A
> > to B you have a check to see if user is still logged on, if he is not
> > logged
> > on your controller servlet show the user the logon page, after success
> at
> > logon, the controller servlet knows that it must now show page B. Does
> this
> > make sense? Your logon page can be called from multiple parts within
> your
> > app.
> 
> You got it. That's exactly the scenario I want to realize.
> BTW there was a typo in my message. Actually the question was:
> "HOW can I realize this?"
> Perhaps a solution could be passing the url of the requested page to the
> logon page as a request attribute, so that the logon action would know
> who
> to forward to.
> Anyway I'd like to know if there's a better/standard way to do this or
> if
> there's an example to refer to.
> 
> > -----Original Message-----
> > From: Stefano Mancarella [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, December 04, 2001 10:12 AM
> > To: Struts Users Mailing List
> > Subject: Smart login page
> >
> >
> > I'm developing a web application with Struts and I'd like to realize
> the
> > following behavior.
> > When I load a page which requires the user to be logged in, I want to
> > invoke
> > a login page and, after a successful logon, forward back to the page I
> had
> > requested.
> > I can I realize this?
> 
> 
> 
> --
> 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]>
> 


__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

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

Reply via email to