Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Session time out in Struts

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I implement session time out using struts. So that if you keep the page open for like 30 min..it will time you out when you come back to the page again.
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The same things apply when using Struts as with any Servlet or other web app where you're using the Java Servlet API. Just use the HttpSession method setMaxInactiveInterval(). The method takes an int argument for the number of seconds, so if you want to set it to 30 minutes, feed it 1800 for the argument.
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also set the session timeout value in your web.xml if you prefer to not do it programatically.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
About doing what Chris proposed, in you web.xml file:
...</servlet-mapping>
<session-config>
<session-timeout>5</session-timeout>
</session-config>
<mime-mapping>...

Here the 5 equals 5 minutes of session inactivity.
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can set session timeout in code

 
Whose rules are you playing by? This tiny ad doesn't respect those rules:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic