www.pudn.com > struts2.rar > MyInterceptor3.java, change:2009-08-19,size:620b


package com.test.interceptor; 
 
import java.util.Map; 
 
import com.opensymphony.xwork2.Action; 
import com.opensymphony.xwork2.ActionInvocation; 
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor; 
 
public class MyInterceptor3 extends MethodFilterInterceptor { 
 
	protected String doIntercept(ActionInvocation invocation) throws Exception { 
		// TODO Auto-generated method stub 
		System.out.println("myInterceptor3"); 
		 
		Map map = invocation.getInvocationContext().getSession(); 
		 
		if(map.get("user") == null) 
			return Action.LOGIN; 
		else 
			return invocation.invoke(); 
		 
	} 
 
}