使用spring 的action-servlet.xml解决struts线程问题
来源:互联网 发布:祝铭震cuba数据 编辑:程序博客网 时间:2024/06/05 08:54
使用spring 的action-servlet.xml解决struts线程问题
<bean name="/register" class="com.action.RegisterAction" singleton="false">
<property name="businessService">
<ref bean="businessService"/>
</property>
</bean>
RegisterAction是Action的实现类,businessService是业务逻辑,Spring把businessService注入到Action中,在Action中只要写businessService的get和set方法就可以了,同时action的bean设为singleton="false",这样每次新建一个实例,从而解决了Struts中Action的线程同步问题
1.struts 中实现接口
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml,/WEB-INF/action-servlet.xml" />
</plug-in>
2.将<action type 变为
= "org.springframework.web.struts.DelegatingActionProxy"
3.编写action-servlet.xml 如:
<bean name="/Analyse" class="com.apple.struts.action.IndexAnalyseAction" singleton="false">
<property name="flowService">
<ref bean="flowService"/> //此处对应applicationContext.xml
</property>
</bean>
4.web.xml中配置
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
- 使用spring 的action-servlet.xml解决struts线程问题
- 线程安全问题(解决) -------使用spring 的action-servlet.xml解决struts线程问题
- 解决spring+struts 找不到Action问题
- 解决乱码问题的最佳解决方式(struts struts2 jsp servlet action等)
- Struts集成Spring出错:Servlet action is not available 的解决
- Struts集成Spring出错:Servlet action is not available 的解决
- Struts集成Spring出错:Servlet action is not available 的解决
- Struts集成Spring出错:Servlet action is not available 的解决
- Struts集成Spring出错:Servlet action is not available 的解决
- Struts集成Spring出错:Servlet action is not available 的解决
- 在struts.xml文件中使用spring代理,管理action
- spring bean的scope属性解决struts action单实例问题
- servlet与Struts action线程安全问题分析
- servlet与Struts action线程安全问题分析
- servlet与Struts action线程安全问题分析
- servlet与Struts action线程安全问题
- servlet与Struts action线程安全问题分析
- servlet与Struts action线程安全
- 经典算法——求最大子序列和
- 名家的生活感悟:
- 那位朋友提供个C#的学习材料!
- CMD使用
- 论文的研究方法&实验方案&技术路线
- 使用spring 的action-servlet.xml解决struts线程问题
- [1061]青蛙的约会
- [Access小贴示]Access中表名为数字或以数字开头的问题
- const关键字放在“类型前”与“类型后”
- 国外远程抄表系统的现状
- [转帖]如何理解C和C++的复杂类型声明
- near指针,far指针,huge指针
- openSUSE全程使用记录(一个新手的成长历程)
- 可以让你少奋斗10年的工作经验