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

📄 personinterceptor.java

📁 struts2实例介绍
💻 JAVA
字号:
package com.test.hibernate;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.test.hibernate.action.LoginAction;

public class PersonInterceptor extends MethodFilterInterceptor {

	@Override
	protected String doIntercept(ActionInvocation vocation) throws Exception {
		if(vocation.getAction() instanceof LoginAction) {
			vocation.invoke();
		}
		ActionContext context = vocation.getInvocationContext();
		Map sessionMap = context.getSession();
		String username = (String)sessionMap.get("username");
		if(username == null || username == "") {
			return "input";
		}
		return vocation.invoke();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -