JavaScud | Forum | JIRA | Blog |
  Dashboard > WebWork2文档中文化计划 > ... > FAQ > How do I get access to the session
  WebWork2文档中文化计划 Log In View a printable version of the current page.  
  How do I get access to the session
Added by scud, last edited by scud on May 19, 2006  (view change)
Labels: 
(None)

Method A:
ActionContext.getContext().getSession() (returns Map, works internally using a ThreadLocal)

Method B (Recommended):
Have the action implements SessionAware, and the Session (as a Map) will be set through the setSession(Map) method. This requires that the 'servlet-config' interceptor being included when the particular action is processed.

@see webwork-default.xml
@see com.opensymphony.webwork.interceptor.SessionAware
@see com.opensymphony.webwork.interceptor.Servlet Config Interceptor

Site running on a free Atlassian Confluence Open Source Project License granted to WebWork China. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.3 Build:#808 May 29, 2007) - Bug/feature request - Contact Administrators