IntelliJ Java IDE
The moose likes Struts and the fly likes Difference between ActionContext.getContext().getSession() and HttpSession Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Struts
Reply 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: 36
What is the difference between ActionContext.getContext().getSession() and HttpSession?
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 427

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: 36
can we set session timeout in ActionContext.getContext().getSession()?
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 427

just configure it in web.xml file

for more details refer the following link. SettingSessionTimeOut
 
 
subject: Difference between ActionContext.getContext().getSession() and HttpSession
 
Threads others viewed
Session var set in JSP
request.getSession() vs request.getSession(boolean create)
Getting "HttpSession" object
Sessions in JSF
accessing httpsession\httpsession attributes in custom validator
MyEclipse, The Clear Choice