File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Redirecting to the same jsp page" Watch "Redirecting to the same jsp page" New topic

Redirecting to the same jsp page

Ramkumar Subburaj
Ranch Hand

Joined: Sep 07, 2007
Posts: 83

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

Joined: Jan 10, 2002
Posts: 63866

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] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Redirecting to the same jsp page
It's not a secret anymore!