举例来说:
在struts-config.xml文件中一段代码如下:
<action attribute="loginForm" input="/login.jsp"
name="loginForm" path="/login" scope="request"
type="org.springframework.web.struts.DelegatingActionProxy">
<forward name="fail" path="/login.jsp" />
<forward name="succeed" path="/welcome.jsp" />
</action>
ApplicationContext.xml里的一段代码如下:
<bean name=" /login" class="web.action.LoginAction"
singleton="false">
<property name="service">
<ref bean="service" />
</property>
</bean>
注意红色字体和蓝色字体,在struts中,让struts只关注页面跳转请求,而具体事务处理交由Spring来完成!
在struts-config.xml文件中一段代码如下:
<action attribute="loginForm" input="/login.jsp"
name="loginForm" path="/login" scope="request"
type="org.springframework.web.struts.DelegatingActionProxy">
<forward name="fail" path="/login.jsp" />
<forward name="succeed" path="/welcome.jsp" />
</action>
ApplicationContext.xml里的一段代码如下:
<bean name=" /login" class="web.action.LoginAction"
singleton="false">
<property name="service">
<ref bean="service" />
</property>
</bean>
注意红色字体和蓝色字体,在struts中,让struts只关注页面跳转请求,而具体事务处理交由Spring来完成!