读书人

struts2跟spring整合比较深入的分析(

发布时间: 2012-10-31 14:37:31 作者: rapoo

struts2和spring整合比较深入的分析(在struts.xml中指定ClassName与指定BeanID的区别)
struts.xml

<!DOCTYPE struts PUBLIC    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"    "http://struts.apache.org/dtds/struts-2.0.dtd"><struts>    <include file="struts-default.xml"/>    <package name="default" extends="struts-default">        <action name="foo" class="com.acme.Foo">            <result>foo.ftl</result>        </action>    </package>    <package name="secure" namespace="/secure" extends="default">        <action name="bar" class="bar">            <result>bar.ftl</result>        </action>    </package></struts>

Where you have a Spring bean defined in your applicationContext.xml named "bar". Note that the com.acme.Foo Action did not need to be changed, because it can be autowired.

?

如何理解这句话,本文附件告诉你答案:? 关于Struts2与Spring整合的一些疑惑及解释。? 文中主要谈在struts.xml中配置Action的时候,在class属性上指定className与指定BeanID的区别。

1 楼 SoloTerran 2010-02-27 lz的文章最后不还是建议把action交给spring么?
如果是把action交给spring托管的话,默认情况下应该是单例吧,面对高频请求会有线程问题么? 2 楼 一的男子 2010-02-28 Spring 里有创建 bar 这个 action 吗? 3 楼 sarin 2010-02-28 struts2的action实例不给spring管理也是多实例的
struts的action是单实例,可以托管给spring变为多实例的。 4 楼 linliangyi2007 2010-03-01 楼主这个帖子太水了,为啥不在帖子正文给出答案哩。 5 楼 kjj 2010-03-01 认识太深了,深得我们看不懂!!!! 6 楼 wxq594808632 2010-03-01 kjj 写道认识太深了,深得我们看不懂!!!!
不知道写的啥.. 7 楼 ziyu_1 2010-03-01 代码的可读性太差. 8 楼 hlylove 2010-03-01 虽然这贴上的代码很乱,但附件文档的内容还是不错的。 9 楼 wanglidhx 2010-03-01 下载看了,很受启发,也很清楚,多谢了,我正在学习struts2+spring 10 楼 ballanfeng 2010-03-01 看了附件内容又学习了,我理解的就是讲解了几种相互依赖的方式,区别应该就是action的实例数不同,还有没有其他区别?

读书人网 >XML SOAP

热点推荐