struts2.1.8 和 spring3.0 整合
时间:2010-12-24 来源:xue2
spring3.0的dist目录中已经不再有之前版面中的spring.jar,而是将各个功能分开,程序员可以按需索取。
经过一番探索,基本找到了环境基本运行条件。
需要spring3.0以下jar文件:
org.springframework.aop-3.0.3.RELEASE.jar//AOP功能
org.springframework.asm-3.0.3.RELEASE.jar//提供对ASM(一个字节码框架)的简单封装
org.springframework.beans-3.0.3.RELEASE.jar// SpringIoC的基础实现
org.springframework.context.support-3.0.3.RELEASE.jar//企业级服务的支持
org.springframework.context-3.0.3.RELEASE.jar//扩展服务
org.springframework.core-3.0.3.RELEASE.jar//提供的基础核心功能
org.springframework.expression-3.0.3.RELEASE.jar//spring表达式语言
需要struts2.1.8jar文件:
struts2-core-2.1.8.1.jar
struts2-spring-plugin-2.1.8.1.jar
commons-fileupload-1.2.1.jar
commons-logging-1.0.4.jar
freemarker-2.3.15.jar
ognl-2.7.3.jar
xwork-core-2.1.6.jar
在web.xml中添加的内容:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>
</context-param>
//applicationContext.xml的位置,classpath*:表示web-inf/class下的位置和jar包中搜索,去掉*,不搜索jar包内容。
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<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> 项目中用到jdbcTemplate的还要再加一些包,详见其他文章
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<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> 项目中用到jdbcTemplate的还要再加一些包,详见其他文章
相关阅读 更多 +
排行榜 更多 +