I am having problem with session management in struts2. I am setting an attribute in the session in an interceptor which is the default interceptor for my entire application. In my action I am implementing SessionAware interface and grabbing the session as a Map. But the attribute which I set in the interceptor is not present in the session Map I have in my action. Did I miss in any default interceptor in my baseAppStack or any idea what I am missing?
My intercepter definition in struts.xml:
My intercepter code:
HttpSession session = request.getSession (true); params = (SessionParams)session.getAttribute(Constants.KEY_SESSION_PARAMS);
if (params == null) {
//some code to populate params
session.setAttribute(Constants.KEY_SESSION_PARAMS, params); }
My Action code:
Map session = getSession();
SessionParams params = (SessionParams) session.get(Constants.KEY_SESSION_PARAMS);