This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes Redirecting to the same jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Redirecting to the same jsp page" Watch "Redirecting to the same jsp page" New topic
Author

Redirecting to the same jsp page

Ramkumar Subburaj
Ranch Hand

Joined: Sep 07, 2007
Posts: 83
Hello,

I have 10 pages in my application and each page has a log in section.

So when the user tries to log in from any any of these 10 pages, i want to redirect the user to the same page.

is there a way in servlet to find from which jsp page the request comes or what is the best way to do it?


SCJP 1.5, SCWCD 1.4.
Hanging between Web Services and EJB
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

You're doing it the hard way. Why have a login on each page?

Rather, check for authentication in a servlet filter. If the user is not logged in, record the URL in the session and forward to a single login page. After login, redirect to the stored URL.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Don't get me started about those stupid light bulbs.
 
subject: Redirecting to the same jsp page