struts2拦截器配置

拦截器

基本配置

struts.xml中
name:自定义拦截器的名称
class:拦截器所在的类


    
    

MyInterceptor.java
实现Interceptor接口,重写方法
package com.ben.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
public class MyInterceptor implements Interceptor{
    @Override
    public String intercept(ActionInvocation arg0) throws Exception {
        // TODO Auto-generated method stub
        return null;
    }
    @Override
    public void destroy() {
        // TODO Auto-generated method stub
    }
    @Override
    public void init() {
        // TODO Auto-generated method stub
    }
}

你可能感兴趣的:(struts2拦截器配置)