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


package com.test.interceptor; 
 
import com.opensymphony.xwork2.ActionInvocation; 
import com.opensymphony.xwork2.interceptor.Interceptor; 
 
public class MyInterceptor implements Interceptor { 
 
	private String hello; 
	 
	 
	 
	public String getHello() { 
		return hello; 
	} 
 
	public void setHello(String hello) { 
		this.hello = hello; 
	} 
 
	public void destroy() { 
		// TODO Auto-generated method stub 
		System.out.println("destroy");  
		 
	} 
 
	public void init() { 
		// TODO Auto-generated method stub 
		System.out.println("init"); 
		System.out.println(hello); 
	} 
 
	public String intercept(ActionInvocation invocation) throws Exception { 
		// TODO Auto-generated method stub 
		System.out.println("interceptor"); 
		String result = invocation.invoke(); 
		System.out.println("finish"); 
		return result; 
	} 
 
}