steps2-->AbstractBaseAction

   我们在编写action中有很多时候,都会在每个action中继承ActionSupport和实现SessionAware, ServletRequestAware, ServletResponseAware,其实想想还是可以优化的,现在姑且叫做AbstractBaseAction吧

import com.opensymphony.xwork2.ActionSupport;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

public abstract class AbstractBaseAction extends ActionSupport implements
SessionAware, ServletRequestAware, ServletResponseAware {
public static final Logger log = Logger.getLogger(AbstractBaseAction.class);//取得log对象,方便在action基类中调用
                  ,对Action的监控 http://o0catty0o.blog.163.com/blog/static/1108551522010623105734274/
public HttpServletRequest request;
public HttpServletResponse response;
public Map session;
//以下这些是一个项目中需要同意命名的
public String callback;
public int start;
public int limit;
public String sort;
public String dir;
public String _dc;
public Integer menuId;

public void setSession(Map session) {
this.session = session;
}

public void setServletRequest(HttpServletRequest httpServletRequest) {
this.request = httpServletRequest;
}

public void setServletResponse(HttpServletResponse httpServletResponse) {
this.response = httpServletResponse;
}

public String get_dc() {
return this._dc;
}

public void set_dc(String _dc) {
this._dc = _dc;
}

public Integer getMenuId() {
return this.menuId;
}

public void setMenuId(Integer menuId) {
this.menuId = menuId;
}

public String getCallback() {
return this.callback;
}

public void setCallback(String callback) {
this.callback = callback;
}

public int getStart() {
return this.start;
}

public void setStart(int start) {
this.start = start;
}

public int getLimit() {
return this.limit;
}

public void setLimit(int limit) {
this.limit = limit;
}

public String getSort() {
return this.sort;
}

public void setSort(String sort) {
this.sort = sort;
}

public String getDir() {
return this.dir;
}

public void setDir(String dir) {
this.dir = dir;
}
}



你可能感兴趣的:(abstract)