This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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..
 
Consider Paul's rocket mass heater.
 
subject: Session handling in struts.