一、框架的引入和整合
1.导入struts2和spring所需的jar包
2.导入spring支持web的jar包(org.springframework.web-3.0.5.RELEASE.jar)
导入spring整合struts2的jar包(struts2-spring-plugin-2.2.3.jar)
3.添加配置文件:struts.xml,applicationContext.xml,log4j.properties
4.配置web.xml:
<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>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
二、框架的使用
1.导入struts2和spring所需的jar包
2.导入spring支持web的jar包(org.springframework.web-3.0.5.RELEASE.jar)
导入spring整合struts2的jar包(struts2-spring-plugin-2.2.3.jar)
3.添加配置文件:struts.xml,applicationContext.xml,log4j.properties
4.配置web.xml:
<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>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
二、框架的使用