BaseAction的一般寫法


package com.mi.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport implements ServletRequestAware,ServletResponseAware,SessionAware{

    private static final long serialVersionUID = 1L;

    public HttpServletRequest request;
    
    public HttpServletResponse response;
    
    public Map<String, Object> sessionData;

    @Override
    public void setSession(Map<String, Object> sessionData) {
        this.sessionData=sessionData;
    }


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

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

}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM