package com.owen.ma;
import java.util.Map;
import org.apache.struts2.interceptor.RequestAware;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
public class BaseAction extends ActionSupport implements RequestAware , SessionAware {
private Map<string, object=""> request;
private Map<string, object=""> session;
@Override
public void setRequest(Map<string, object=""> request) {
this.request = request;
}
@Override
public void setSession(Map<string, object=""> session) {
this.session = session;
}
public Object getAttribute(String key) {
if (this.request.containsKey(key)) {
return this.request.get(key);
}
return null;
}
public void setAttribute(String key, Object object) {
if (this.request.containsKey(key)) {
this.request.remove(key);
this.request.put(key, object);
}
}
public Object getSession(String key) {
if (this.session.containsKey(key)) {
return this.session.get(key);
}
return null;
}
public void setSession(String key, Object object) {
if (this.session.containsKey(key)) {
this.session.remove(key);
this.session.put(key, object);
}
}
}