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的区别。
本文探讨了在Struts2框架中如何通过配置文件struts.xml整合Spring框架,重点介绍了在定义Action时使用类名与Bean ID的区别。通过具体示例说明了不同配置方式下Action的处理过程。

被折叠的 条评论
为什么被折叠?



