Jakub Milkiewicz wrote:
Hi
I have a problem with Struts 2.
I am looking for a way to access httpsession id?
I have tried using ActionContext.getContext().getSession().get("id") but it
returns null. i 've read there is a possibility to use Servlet Config
Interceptor<http://www.opensymphony.com/webwork/wikidocs/Servlet%20Config%20Interceptor.html>
but i would not like to do it.
ActionContext.getSession() gives you access to the session scope
attributes, not the session itself. To get to the actual session object,
obtain the HttpServletRequest object [1] and get the session from there:
HttpServletRequest request = ...; // use ActionContext or
ServletRequuestAware
HttpSession session = request.getSession();
String sessionId = session.getId();
L.
[1]
http://struts.apache.org/2.0.11.1/docs/how-can-we-access-the-httpservletrequest.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]