wood burning stoves*
The moose likes Struts and the fly likes Difference between ActionContext.getContext().getSession() and HttpSession Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Difference between ActionContext.getContext().getSession() and HttpSession" Watch "Difference between ActionContext.getContext().getSession() and HttpSession" New topic
Author

Difference between ActionContext.getContext().getSession() and HttpSession

Dev Anand
Ranch Hand

Joined: Aug 30, 2009
Posts: 41
What is the difference between ActionContext.getContext().getSession() and HttpSession?
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

No difference, Struts 2 internally uses Servlets and session ActionContext is implements using ThreadLocal so we can access session from ActionContext but we should use SessionAware interface to get session object.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Dev Anand
Ranch Hand

Joined: Aug 30, 2009
Posts: 41
can we set session timeout in ActionContext.getContext().getSession()?
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

just configure it in web.xml file

for more details refer the following link. SettingSessionTimeOut
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Difference between ActionContext.getContext().getSession() and HttpSession
 
Similar Threads
Getting "HttpSession" object
Sessions in JSF
request.getSession() vs request.getSession(boolean create)
accessing httpsession\httpsession attributes in custom validator
Session var set in JSP