Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirection when session expires 1

Status
Not open for further replies.

Gaelle

Programmer
Jun 20, 2001
62
FR
Hi !

It's me again asking silly questions about JSP !
Is there a way to tell pages or sessions : when the session expires (time out), and the user cliks anywhere not available any longer, redirect him to the URL : index.jsp for example ?

Thanks !
Gaelle, from France.
 
I'm sure theres a better way but i usually just add in a little code at the top saying

if((String)session.getAttribute("Username").equals(""))
{
response.redirect("../thispages.jsp");
}
else
{
reset of code
}

I just use an attribute which i know should always contain something. This is also a useful (probably not too good but useful none the less) way of placing security on the page. If the username is equal to "" then they have not yet been verified.

hope this helps
Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top