基于S2SH框架的项目—web.xml文件配置


为了Spring和Strust2的完美结合,需要在web.xml文件加入如下几部分代码

1、Spring配置文件

默认情况下,Spring配置文件为applicationContext.xml,该文件保存在src目录下。

  <!-- 用来定位Spring XML文件的上下文配置 --> 
 <context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>classpath:applicationContext.xml</param-value> 
 </context-param>

2、配置Spring监听器

<listener>
      <listener-class>
    org.springframework.web.context.ContextLoaderListener
      </listener-class>
</listener>

相关内容