让spring接管我们的struts(action控件)
一 在struts-config.xml文件中添加如下代码配置
<!-- 配置代理请求处理 DelegatingRequestProcessor ,它的用户是 -->
<controller>
<set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/>
</controller>
二 在applicationcontext.xml文件中配置我们的action路径
<!-- 配置action -->
<bean name="/login" scope="prototype" class="com.hsp.web.action.LoginAction"/>
<bean name="/employee" scope="prototype" class="com.hsp.web.action.EmployeeAction">
<property name="departmentService" ref="departmentService"/>
<property name="employeeService" ref="employeeService"/>
</bean>
我们就可以通过spring容器来获取action,和配置action的一些属性
三 通过使用sping来接管我们的action,还有一个好处,可以解决action是单例的问题
通过在applicationContext.xml文件中配置属性<bean scope=”singlton/prototype/request/sesssion/global session”/>