Spring+Struts整合开发步骤:
1.在Struts-config.xml中加入插件
<!-- 加入插件 -->
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
</plug-in>
2.在Struts-config.xml中将Action type改为DelegatingActionProxy
<!-- 将Action type改为DelegatingActionProxy -->
type="org.springframework.web.struts.DelegatingActionProxy" >
3.在Spring配置文件中加入Bean
<!-- 配置dao -->
<bean id="userInfoDao" class="com.itjob.dao.impl.UserInfoDaoImpl">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<!-- 配置service -->
<bean id="userInfoService" class="com.itjob.service.impl.UserInfoServiceImpl">
<property name="dao">
<ref local="userInfoDao"/>
</property>
</bean>
<!-- 配置Action-->
<bean name="/reg" class="com.itjob.web.action.RegAction">
<property name="service">
<ref local="userInfoService"/>
</property>
<property name="userInfo">
<bean name="userInfo" class="com.itjob.entity.UserInfo"/>
</property>
</bean>