Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session timeout - how does it work?

 
Raj Puri
Ranch Hand
Posts: 189
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I set session time out to 30 minutes in web.xml file using:

session-config>30</session-config>

And I have a code like this in submit button:
<% if (!session.isNew()) { %>
alert("Session timeout, please close browser and restart session");
return false;
<% } %>

Seems no matter what the browser thinks it is an old session going on. I am
doing JSP page and want to set timeout in web.xml and have that message show up if noactivity for 30 minute. I have tried closing, restarting browser/Tomcat etc.

How can i do this?
 
Tim Baker
Ranch Hand
Posts: 541
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your logic seems odd, surely it should be

if session is new show message "session expired"
 
Surasak Leenapongpanit
Ranch Hand
Posts: 341
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should be..

<% if (session.isNew()) { %>
alert("Session timeout, please close browser and restart session");
return false;
<% } %>
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic