zoukankan      html  css  js  c++  java
  • 【java struts2】Filters vs Interceptors in Struts 2

    The most significant difference is that "interceptors" are a part of the Struts 2 framework, and are only part of the request handling that is done by the Struts 2 framework. "Filters" on the other hand are a part of the Servlet Specifcation; in other words, they are part of the Servlet API. If you are using Struts 2, you should use interceptors for wrapping functionality around your Struts 2 actions. If you are trying to wrap functionality around requests coming to your webapp, but not being handled by Struts 2, then a filter might be more appropriate.

    BTW, the entire Struts 2 Framework is deployed inside a filter configured in your web app, declared in your webapp's deployment descriptor ( web.xml ) like:

    <filter>
            <filter-name>struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        </filter>
    
         <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    

      This filter, which is configured to catch all requests URL patterns, is the entry point into the entire Struts 2 framework.

  • 相关阅读:
    tr 字符转换命令
    Log4cpp配置文件及动态调整日志级别的方法
    Ubuntu使用总结
    vim安装与配置(进阶版)
    [转载] Linux CC与GCC的区别
    C语言基础总结
    VIM之ctags & Taglist 插件
    vim之基础配置
    使用问题:Chrome卡死崩溃
    Ubuntu16.10安装之后的软件安装
  • 原文地址:https://www.cnblogs.com/m3Lee/p/3477157.html
Copyright © 2011-2022 走看看