上篇文章详细记录了struts2环境配置的步骤,此篇文章主要记录strtus2整合spring环境配置
- 添加包
- web.xml中相关配置
- 创建spring配置文件
- 编写测试类
1.添加包(并build path)
包链接:
2.在web.xml中设置监听器,并指明随后创建的spring的配置文件的地址
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>jsp/index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>