JavaEE笔记(七)

Struts获取如何获取请求响应和回话

//获取HttpServletRequest
HttpServletRequest request = ServletActionContext.getRequest();
//获取HttpServletResponse
HttpServletResponse response= ServletActionContext.getResponse();
//获取session回话
HttpSession session = request.getSession();

Struts封装的请求回话
//首先获取ActionContext 
ActionContext actionContext = ActionContext.getContext()
//请求级以map的形式存放数据
actionContext.put(key,value);
//获取map类型的session
Map<String, Object> session = actionContext.getSession();
//回话级以map的形式存放数据
session.put(key,value);

我不作恶

但有权拒绝为善

我不赞同

但是我捍卫你不为善的权力

原文地址:https://www.cnblogs.com/HackerBlog/p/6132508.html