struts2如何拦截文件夹内的所用jsp页面呢?

解决方案 »

  1.   


    <filter-mapping>
       <filter-name>struts2</filter-name>
       <url-pattern>/view/*.jsp</url-pattern>
      </filter-mapping>
      

  2.   

    struts2 的原理是这样嘛?
      struts2的核心拦截器是对所有的request请求做拦截的,再去找struts2的配置文件,mapping获取 要访问的action,
    请问<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/view/*.jsp</url-pattern>
    </filter-mapping>
     dispacher 能做处理嘛?
      

  3.   

    我是用过struts2的interceptor拦截action,貌似jsp不能拦
    public class ManagerInterceptor extends AbstractInterceptor
    {
    public String intercept(ActionInvocation invocate) throws Exception 
    {
                    //相当于执行了action的execute方法。
                    String result = invocate();
                    return result;
            }
    }
    <interceptors>
    <interceptor name="managerInterceptor" class="interceptor.ManagerInterceptor"/>
    </interceptors>
      

  4.   

    代码只贴了一部分而已。。
    自己先学一下filter拦截器和interceptor过滤器把。。
      

  5.   

    ...............
    <filter-mapping>
          <filter-name>struts2</filter-name>
          <url-pattern>/view/*.jsp</url-pattern>
      </filter-mapping>拦截不了吗?lz的用途是什么啊
      

  6.   

     Strutsw2的interceptor只能拦截Action 拦截JSP 写个过滤器
      

  7.   

    楼主,拦截文件夹下的jsp用过滤器没错,仔细检查检查