baseaction.java
来自「simesh用于WEB界面开发的一个架构. 这是学习他的一个小例子」· Java 代码 · 共 48 行
JAVA
48 行
package com.rumtel.wep.actions;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.configuration.Configuration;
import com.opensymphony.webwork.ServletActionContext;
import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.ActionSupport;
import com.rumtel.wep.config.ApplicationConfiguration;
public abstract class BaseAction extends ActionSupport {
public static final String USERID_KEY = "userId";
public static final String PASSWORD_KEY = "password";
public static final String USERNAME_KEY = "userName";
// Session related -----------------------------------
protected void clearSession() {
getSession().remove(USERNAME_KEY);
getSession().remove(USERID_KEY);
getSession().remove(PASSWORD_KEY);
}
protected Map getApplication() {
return ActionContext.getContext().getApplication();
}
protected HttpServletRequest getRequest() {
return ServletActionContext.getRequest();
}
protected HttpServletResponse getResponse() {
return ServletActionContext.getResponse();
}
protected Map getSession() {
return ActionContext.getContext().getSession();
}
protected Configuration getConfig() {
return ApplicationConfiguration.getConfiguration();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?