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);
}
}
BaseAction常用方法封装
Struts2基类设计
最新推荐文章于 2025-10-30 14:46:43 发布
本文介绍了一个基于Struts2框架的通用基类(BaseAction)设计,该基类继承自ActionSupport并提供了获取会话、上下文参数等常用功能。
2197

被折叠的 条评论
为什么被折叠?



