⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 baseaction.java

📁 simesh用于WEB界面开发的一个架构. 这是学习他的一个小例子
💻 JAVA
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -