• 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;
    }
    }



  • 相关阅读:
    面向消息的持久通信与面向流的通信
    通信协议
    [1]序章,基本
    深拷贝和浅拷贝
    堆/栈 内存管理相关
    C++的四种cast(显示类型转换)
    智能指针相关
    C++对象模型:单继承,多继承,虚继承
    HTTP/TCP
    [读书笔记] 为什么绝不在构造/析构函数中调用virtual函数
  • 原文地址:https://www.cnblogs.com/GenghisKhan/p/2314106.html
Copyright © 2020-2023  润新知