It's not a secret anymore!*
The moose likes Struts and the fly likes Session handling in struts. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Session handling in struts." Watch "Session handling in struts." New topic
Author

Session handling in struts.

Suhas Bilaye
Ranch Hand

Joined: Sep 10, 2009
Posts: 80
Hi,

I want to figure out how I can set a session timeout in struts without using web.xml file. Is there any way where I can put a declarative global entry for session timeout in the struts config. Please suggest.


Thanks and Regards,
Suhas
http://www.xplore-java.blogspot.com/
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

I have never seen such session time out configuration at Struts.xml. But why you need functionality. It's better define at web.xml


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Nishan is correct--there's nothing for session handling in Struts. Sessions are handled by the container, not frameworks running in the container.
Suhas Bilaye
Ranch Hand

Joined: Sep 10, 2009
Posts: 80
Thanks for the reply

Could you tell me if I have a session scope for one of the action mappings element in the struts config.
Then what will happen if session timeout occurs (web.xml) during the execution of that action?
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

When you are declaring Session time out Container consider your session idea time for time out your session.

For example if you set your Session time out 15 Min. And you session use in your action then it will not time out by container. But it last 15 Min your session not use your application then and then your that session time out.

If you are using Session at your action then this session not time out by container. It considers only Session idea time for time out.

So don't worry about declaring it in to Web.xml.
Suhas Bilaye
Ranch Hand

Joined: Sep 10, 2009
Posts: 80
Thanks..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session handling in struts.
 
Similar Threads
warn the user before session timeout & login back when session time out is over
session expiration in struts
Navigate to login page in case of invalid session
some about apache tomcat session?
Struts selection