BaseAction常用方法封装

public class BaseAction extends ActionSupport{

	private static final long serialVersionUID = 1348913248;
	
	public Map<String, Object> getSession(){
		return ActionContext.getContext().getSession();
	}
	
	public Map<String, Object> getContextMap(){
		return ActionContext.getContext().getContextMap();
	}
	
	public Map<String, Object> getParamMap(){
		return ActionContext.getContext().getParameters();
	}
	
	public ActionContext getContext(){
		return ActionContext.getContext();
	}
	
	public void putInSession(String key, Object value){
		this.getSession().put(key, value);
	}
	
	public void putInContext(String key, Object value){
		this.getContextMap().put(key, value);
	}
}

你可能感兴趣的:(action)