aspose file tools*
The moose likes JSP and the fly likes Redirecting to login.jsp page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Redirecting to login.jsp page?" Watch "Redirecting to login.jsp page?" New topic
Author

Redirecting to login.jsp page?

james billa
Greenhorn

Joined: Jul 08, 2008
Posts: 5
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

Joined: Jan 10, 2002
Posts: 61224
    
  66

Servlet filter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rajat Raina
Greenhorn

Joined: Feb 17, 2009
Posts: 10
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.


To be a winner first you need to be a begineer.
Raina Rajat
SCWCD (95%)
SCJP(70%)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

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.
 
Consider Paul's rocket mass heater.
 
subject: Redirecting to login.jsp page?