• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redirecting to login.jsp page?

 
james billa
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets say I have 100 different JSP pages and as a developer, I know the url for each and every single page. Now if without logging in, If I try any of my jsp page with the direct url for that page, I should be always redirected to my login.jsp page. How to do it and if i need to write a piece of code, I want to write it globally and not in each page. Can you please tell me how to do it?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlet filter.
 
Rajat Raina
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can you a session listener as when you try to request from the browser a new session will be created and then you can check if it is from login page or else you can redirect it to login page.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A session listener is not useful in this case. The session can exist before or after logout and is not a deterministic indication of logged-in state.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic