第一种方式,非IoC(Spring中的控制反转)方式: /** * File Name:BaseAction.java * Version: * Date:2010-1-27 * Copyright Belongs To Musoon Corporation 2010 */package com.action;import java.util.Map;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts2.ServletActionContext;import com.opensymphony.xwork2.ActionContext;import com.opensymphony.xwork2.ActionSupport;/** * Project Name:ZhiMing ** Class Name:BaseAction * Author:Musoon ** Created Time:2010-1-27 下午06:45:35 * Changed By:Musoon ** Changed Time:2010-1-27 下午06:45:35 * Changed Memo: * @version * Class Description: */public class BaseAction extends ActionSupport {private static final long serialVersionUID = 7620009925942346125L;ActionContext context = ActionContext.getContext();HttpServletRequest request = (HttpServletRequest) context.get(ServletActionContext.HTTP_REQUEST);HttpServletResponse response = (HttpServletResponse) context.get(ServletActionContext.HTTP_RESPONSE);Map session = context.getSession();//SessionMap session = (SessionMap) context.get(ActionContext.SESSION);}/** * File Nam 你的当前访问异常,请进行认证后继续阅读剩余内容。 提交