本站首页    管理页面    写新日志    退出

«September 2025»
123456
78910111213
14151617181920
21222324252627
282930


公告

  如果你忍了,欺负你的人将来可能就进监狱了。如果你反击,欺负你的人将来可能就获选十大杰出青年了。

        QQ: 3159671

http://greenboy.javaeye.com/

http://blog.sina.com.cn/u/1278341164 小鸟吹烟


我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:小鸟吹烟
日志总数:157
评论数量:424
留言数量:-1
访问次数:1257970
建立时间:2006年10月23日




[SSH 学习区]使用spring 的action-servlet.xml解决struts线程问题
随笔,  读书笔记,  心得体会,  软件技术

tone 发表于 2007/1/27 10:14:13

  <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> 


阅读全文(5237) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.047 second(s), page refreshed 144778063 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号