Sturts 2 session invalidation with setting request session to a new session

后端 未结 1 1670
情深已故
情深已故 2020-12-18 14:29

In my Struts application once an user login I need to invalidate the current session and create a new session. I invalidate the session with

getHttpServletRe         


        
相关标签:
1条回答
  • 2020-12-18 15:17

    If you want to access the struts session after you invalidated the servlet session you should update or renew the struts session. For example

    SessionMap session = (SessionMap) ActionContext.getContext().getSession();
    
    //invalidate
    session.invalidate();
    
    //renew servlet session
    session.put("renewServletSession", null);
    session.remove("renewServletSession");
    
    //populate the struts session
    session.entrySet();
    

    now struts session is ready to use the new servlet session and you ready to reuse the struts session.

    0 讨论(0)
提交回复
热议问题