This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Redirecting to login.jsp page?" Watch "Redirecting to login.jsp page?" New topic

Redirecting to login.jsp page?

james billa

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

Joined: Jan 10, 2002
Posts: 60810

Servlet filter.

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

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%)
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60810

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.
I agree. Here's the link:
subject: Redirecting to login.jsp page?
Similar Threads
show different URL than my server..
IP Address of Webserver
sending parameters through redirecting
How to use Actions inside Javascript menus???
communication between browsers