web.xml中一些标签的解释

<context-param>    --web容器参数
  <param-name>contextConfigLocation</param-name> --参数名称(就是你自己到时候调用Spring时候在容器中寻找的资源名称)
  <param-value>/WEB-INF/applicationContext-*.xml</param-value>  --参数值(指你配置的资源地址)
</context-param>   --标签后缀不用解释吧
<filter>  --过滤器标记
   <filter-name>struts2</filter-name>  --过滤器名称可以按自己的想法去给名字
   <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>  --指定具体哪个过滤器处理的类路径
</filter>
<filter-mapping>  --过滤器的映射标签
    <filter-name>struts2</filter-name> -- 过滤名是对应你上面取的struts2 这个名字,目的是为了通过名称的统一找到过滤器处理类 所谓的映射 也就是这个意思
    <url-pattern>/*</url-pattern>  --请求路径 ,这里用“*”通配符: 表示所有的请求都会被拦截进入过滤器中过滤
</filter-mapping>
<listener>     -- 监听器                                    
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> --整合了spring后的项目,服务一启动的时候spring容器监听器就进行了注册
   </listener>

   <listener>
     <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> --同上面一样这个是spring的日志监听器注册
   </listener>

猜你喜欢

转载自munchlex.iteye.com/blog/1288054