java 代码
- webwork Action中获取request, response对象的方法
- import com.opensymphony.xwork.ActionSupport;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import com.opensymphony.webwork.ServletActionContext;
- import com.opensymphony.xwork.ActionContext;
- ActionContext ctx = ActionContext.getContext();
- HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
- HttpServletResponse response = (HttpServletResponse)ctx.get(ServletActionContext.HTTP_RESPONSE);
- //ServletActionContext.APPLICATION;
- //ServletActionContext.SESSION;
- //ServletActionContext.PAGE_CONTEXT;
本文介绍如何在WebWork框架的Action类中通过ActionContext和ServletActionContext获取HttpServletRequest和HttpServletResponse对象,以便进行更高级的Web操作。
160

被折叠的 条评论
为什么被折叠?



