ActionContext.getContext().getSession().put("msg", "hello world struts2!");
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
HttpSession session = request.getSession();
session.setAttribute("user", "pla");
Cookie c = new Cookie ("myck","My Cookie!!");
response.addCookie(c);和<h2>the value of msg in the sessionScope is ${sessionScope.msg}</h2>
<h2>the value of user in the sessionScope is ${sessionScope.user}</h2>
<h2>the value of cookie is ${cookie.myck.value}</h2>为什么我测试之后,只有cookie那个值能取出来呢?如果还有什么不懂,我再贴出源码