📄 bookmodifyinterceptor.java
字号:
package org.wiely.interceptor;
import java.util.Map;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
/**
* BookModifyInterceptor extends MethodFilterInterceptor
* when stranger opration Book value Object ,he must be administrator
* if he isn't,the page redirect to the slogin.jsp
*/
@SuppressWarnings("serial")
public class BookModifyInterceptor extends MethodFilterInterceptor {
@SuppressWarnings("unchecked")
@Override
protected String doIntercept(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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -