JavaScud | Forum | JIRA | Blog |
  Dashboard > WebWork2文档中文化计划 > ... > Misc > HttpSession in Action
  WebWork2文档中文化计划 Log In View a printable version of the current page.  
  HttpSession in Action
Added by scud, last edited by scud on May 19, 2006  (view change)
Labels: 
(None)

Use this if you want to be web agnostic (independent of the servlet API)

ActionContext.getContext().getSession()

The following gives you the same thing as above:

ServletActionContext.getRequest().getSession()

Note: Be sure not to use ActionContext.getContext() in the constructor of your action since the values may not be set up already (returning null for getSession()).

If you really need to get access to the HttpSession, use the ServletConfigInterceptor (see Interceptors).

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