bulletioninterceptor.java
来自「有简单的网上书店需求及设计流程」· Java 代码 · 共 31 行
JAVA
31 行
package org.wiely.interceptor;
import java.util.Map;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
/**
* Bulletion extends AbstractInterceptor
* when update the bulletion ,you must be administrator,if
* you aren'nt administrator,the page redirect the administrator slogin.jsp.
*/
@SuppressWarnings("serial")
public class BulletionInterceptor extends AbstractInterceptor {
@SuppressWarnings("unchecked")
@Override
public String intercept(ActionInvocation invocation) throws Exception {
Map session = ActionContext.getContext().getSession();
if (session.get("admin") == null) {
return "adminlogin";
} else {
return invocation.invoke();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?