struts2和spring整合時需要注意的地方

2021-08-13 16:05:15 字數 344 閱讀 8463

org.springframework.web.context.contextloaderlistener

contextconfiglocation

2、對struts.xml配置檔案的乙個地方進行修改即可

原來的配置檔案action為:

整合的配置檔案action為:

--注:這裡的calss從spring容器裡面拿,而不是自己new物件,

所以這裡為容器中中的id的值

(特別注意:struts框架會從spring容器中拿物件是依靠之前匯入的struts2-spring-plugin.jar包,否則不會到spring容器中去找,會報錯說找不到useraction類)

Struts 2整合Spring 經典

struts 2整合spring struts 2框架為整合其他技術提供了良好的可擴充套件性,可以通過外掛程式的方式來實現同spring技術的整合。13.2.1 整合步驟 struts 2框架整合spring很簡單,下面是整合的步驟。1 複製檔案。複製struts2 spring plugin x ...

struts2整合spring步驟

1.匯入spring的核心包 spring.jar 二者整合開發所需的包 struts spring plugin 2.0.6.jar 2.修改web.xml配置檔案 配置spring載入上下文時的 org.springframework.web.context.contextloaderliste...

Struts2整合Spring2入門

1.新增spring支援 2.新增struts2的spring外掛程式 struts2 spring plugin 2.0.11.jar 3.在web.xml中新增 啟動spring容器 org.springframework.web.context.contextloaderlistener 4....