看一下文章说要在STRUTS的配置文件中加入插件
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"value="classpath:applicationContext.xml" />
</plug-in>我想如果不加入插件,而是用以下方法: <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/classpath:pplicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
达到的效果是不是一样的呢???
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"value="classpath:applicationContext.xml" />
</plug-in>我想如果不加入插件,而是用以下方法: <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/classpath:pplicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
达到的效果是不是一样的呢???
<param-name>contextConfigLocation</param-name>
<param-value>/classpath:pplicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
这个配置是当web窗口启动时同时启动Spring容器,与集成Struts无关。Spring 集成 Struts有两种方法:
第一种就是楼主说的插件模式,把Spring当作Struts1.x的插件
第二种就是更换控制器,Struts1.x有个默认的控制器,现在通过下面的配置换成Spring的控制器,从而将Struts的action当作bean交给Spring管理:
<controller>
<set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/>
</controller>
一般都用第二种方案。