This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between ActionContext.getContext().getSession() and HttpSession
 
Similar Threads
Sessions in JSF
accessing httpsession\httpsession attributes in custom validator
Session var set in JSP
request.getSession() vs request.getSession(boolean create)
Getting "HttpSession" object