Action中如何访问session对象
你可以通过访问ActionContext对象或者实现SessionAware接口来实现
1.访问ActionContext对象:Map attibutes = ActionContext.getContext().getSession();
2.实现SessionAware接口 ,前提:已配置servlet-config 拦截器
如何获取HttpServletRequest
1.访问ServletActionContext:HttpServletRequest request = ServletActionContext.getRequest();
2.实现ServletRequestAware接口,前提:已配置servlet-config 拦截器
如何获取HttpServletResponse
1.访问ServletActionContext: HttpServletResponse response = ServletActionContext.getResponse();
2.实现ServletResponseAware接口,前提:已配置servlet-config 拦截器
如何过的传入到Action中的request parameters
1.访问ActionContext对象:Map parameters = ActionContext.getContext().getParameters();
2.实现ParameterAware接口 ,前提:已配置servlet-config 拦截器