怎样获取session中的保存的对象的值:

ActionContext ctx = ActionContext.getContext();

 

//ctx.put("liuwei", "andy");//request.setAttribute("liuwei", "andy");

       Map session =ctx.getSession(); //session

       HttpServletRequest request= (HttpServletRequest) ctx.get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);

       HttpServletResponse response= (HttpServletResponse) ctx.get(org.apache.struts2.StrutsStatics.HTTP_RESPONSE);

       Userinfo user=(Userinfo)session.get("user");

 

参考博客http://apps.hi.baidu.com/share/detail/30710520

你可能感兴趣的:(session,user)