Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redirecting to the same jsp page

 
Ramkumar Subburaj
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic