首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

spring + Struts 调整 (二)

2012-09-02 
spring + Struts 整合 (二)下面是记录struts和spring的整合第二种方式,以防止忘记。action交给spring管理,

spring + Struts 整合 (二)

下面是记录struts和spring的整合第二种方式,以防止忘记。

action交给spring管理,首先需要在struts配置文件中配置一个spring插件,

<controller processor
?????? value="/WEB-INF/classes/ctxconf/spring/applicationContext.xml/>
?</plug-in>

?

并且所有的action中的type都需要配置为:

<action input="/index.jsp"
????name="LoginForm"
????parameter="method"
????scope="request"
????path="/login" ????
????type="org.springframework.web.struts.DelegatingActionProxy">
? ???<forward name="success1" path="/jsp/interface/demo.jsp" />
? ???<forward name="success" path="/jsp/interface/main.jsp" />
? ???<forward name="failure" path="/index.jsp" />
?</action>

并且所有的action都需要在spring中注册

<bean name="/login" />
??</property>
?</bean>

此时在web.xml中也不需要在配置上下文监听的信息了

其中注意的地方有spring中注册action的name与struts配置文件中path的值一样,必须一样。

热点排行