struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Dribin <dave...@dribin.org>
Subject Re: Forward after <check-login>
Date Tue, 23 Apr 2002 19:41:01 GMT

This seems to work to build up a "done" parameter:

    StringBuffer done = request.getRequestURL();
    String query = request.getQueryString();
    if (query != null)
    {
        done.append("?").append(query);
    }
    response.sendRedirect(request.getContextPath() +
                                      "/login.jsp?done=" + done.toString());

After login is successful, it redirects to the "done" parameter.  I
would have thought that the query would need to be URL-encoded, but I
have not had a problem, yet.

BTW, sticking this in the URL seems like the best way, IMO.  Sticking
this in the session has potential to be trashed if the user has 2
windows open.  I've noticed that Yahoo! places a URL as a parameter if
you try and access a page that requires authentication, too:

  https://bills.secure.yahoo.com/bpp?u

-Dave

On Tue, Apr 23, 2002 at 10:31:26AM -0700, Andy Timm wrote:
> Robert - I'm doing this now, I was hoping do find a
> better way to deal with parameters.  I can forward to
> the page just fine, but when that page needs
> parameters off the URL, it starts to get messy. 
> Anyone have a code snippet readily available that
> grabs everything but the hostname from the URL -
> including params?  Thanks again.
> 
> --- Robert <rmcintosh@bull-enterprises.com> wrote:
> > I've done this by supplying the 'current' page as a
> > parameter to the
> > login page/service. After a successful login, a
> > forward is done to that
> > location. I'm not sure what your <check-login> tag
> > looks like, but this
> > could be a parameter of it, which is then supplied
> > to the login
> > mechanism. You could probably also supply the
> > current page in the
> > session.
> > 
> > - Robert
> > 
> > -----Original Message-----
> > From: Andy Timm [mailto:java_coder@yahoo.com] 
> > Sent: Tuesday, April 23, 2002 11:13 AM
> > To: struts-user@jakarta.apache.org
> > Subject: Forward after <check-login>
> > 
> > I have some pages which require a user to be logged
> > in
> > and some which do not.  If the <check-login> tag
> > determines that there is no user logged in, the user
> > is forwarded to the login page.  I'd like to
> > remember
> > where the user came from and forward them there
> > after
> > a successful authentication.  I'm sure there are
> > multiple ways of doing this and I would like some
> > advice.  Thanks, Andrew Timm
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Games - play chess, backgammon, pool and more
> > http://games.yahoo.com/
> > 
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:  
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Games - play chess, backgammon, pool and more
> http://games.yahoo.com/
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message