struts2整合spring步驟

1.導入spring的核心包:spring.jar
二者集成開發所需的包:struts-spring-plugin-2.0.6.jar

2.修改web.xml配置文件
配置spring加載上下文時的監聽器
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

3.先改一下 src/struts.properties 文件,增加:
struts.objectFactory = spring 
或者在struts.xml中常量配置

4.spring配置文件改爲:
<beans default-autowire="autodetect">

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章