1.加入jar包
复制文件。
复制struts2-spring-plugin-x-x-x.jar和spring.jar到WEB-INF/lib目录下。其中的x对应了Spring的版本号。还需要复制commons-logging.jar、struts2-core-2.3.4.1.jar文件到WEB-INF/lib目录下。
2. 配置web.xml
< xml version="1.0" encoding="UTF-8" >
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
org.springframework.web.context.ContextLoaderListener
classpath:/applicationContext*.xml
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
org.apache.struts2.dispatcher.ActionContextCleanUp
3.添加struts2-spring整合的插件:struts2-spring-plugin-2.0.12.jar,如果不使用这个插件,则需要在struts.xml里面配置:
推荐阅读: