How do I retain a requested url with parameters after redirecting to a login page?

Posted by Brent Parker on Stack Overflow See other posts from Stack Overflow or by Brent Parker
Published on 2010-03-19T20:35:25Z Indexed on 2010/03/19 20:41 UTC
Read the original article Hit count: 231

Filed under:
|
|
|

I have been asked to set up some authentication for some content on our website using JSP. What I would like to do seems simple to me but I can't quite figure out how to do it in JSP.

What I would like to do is this: When a user requests a page that you must be logged in to see, I have a tag that checks their cookies for an authentication token. If it is not there, they are redirected to a login page. After they log in, I want to redirect them back to the page they first requested along with any parameters they were sending.

Now, I have the tag that is checking their authentication and redirecting them to the login page. That part is working just fine. But I'm not sure how to maintain the first requested url and parameters so they can be redirected after they login. How might I accomplish this?

© Stack Overflow or respective owner

Related posts about jsp

Related posts about java