歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> 基於S2SH框架的項目—web.xml文件配置

基於S2SH框架的項目—web.xml文件配置

日期:2017/3/1 10:04:38   编辑:Linux編程

為了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>

Copyright © Linux教程網 All Rights Reserved