• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

session invalidate  RSS feed

 
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

i configure session timeout in my web.xml....

when the session time is complete,it is going to login page!!!.

i can not understand why it is?(by default going to loginpage(index.jsp)).....


but i want to show another jsp page after timeout...

please can anyone explain me..

thanks & regards,
seetharaman
 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In the sessionDestroyed method of SessionListener, forward to the signup page(whatever you want) using the Servlet Context's request dispatcher.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ashok,
Thanks for your earnest reply...

well,..but my sessionDestroyed() method is in java class..

here how can i get request object so that,i can forward to my jsp page..

please explain me..

thanks & regards,
seetharaman
 
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can write a filter, which forwards to login page, if theres no session.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

can anyone tell how to use RequestDispatched or anyother mechanism to forward to my jsp page...
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


here how can i get request object so that,i can forward to my jsp page..



You can't - there will never be a request when a session times out and is invalidated by the servlet container because initial processing of a request resets the timer for the matching session.

Bill
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William,

i want to show my jsp page..after session timeout in DD.for that wat can i do?..

i am waiting for your earnest reply..

thanks & regards,
seetharaman
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think about this:

How will you identify a request as belonging to a recent user whose session timed out versus a request from a brand new user?

There is no way you can do this using ONLY the session mechanism.

I suggest you could use c ookies just like commercial sites do. Amazon recognizes me because my browser has (one or more) long-lived c ookie specific to the Amazon URL.

See the JavaDocs for java.servlet.http.C ookie for an introduction on how to create your own c ookies. Search for RFC 2965 for the complete rules on c ookies.

Bill
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks william ;)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!