Privilegelnterceptor
来源:互联网 发布:mac怎么截gif 编辑:程序博客网 时间:2024/06/05 08:02
package cn.edu.hgu.interceptor;
import java.util.Map;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import cn.edu.hgu.bean.User;
public class Privilegelnterceptor extends MethodFilterInterceptor{
@Override
protected String doIntercept(ActionInvocation invocation) throws Exception {
Map<String, Object> session = ActionContext.getContext().getSession();
User user = (User) session.get("u");
if(user!=null){
return invocation.invoke();
}else{
return "login";
}
}
}
import java.util.Map;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import cn.edu.hgu.bean.User;
public class Privilegelnterceptor extends MethodFilterInterceptor{
@Override
protected String doIntercept(ActionInvocation invocation) throws Exception {
Map<String, Object> session = ActionContext.getContext().getSession();
User user = (User) session.get("u");
if(user!=null){
return invocation.invoke();
}else{
return "login";
}
}
}
阅读全文
0 0