spring_Struts2 xml配置

要让Spring管理sturts2 要在struts.xlm中加入以下配置  <constant name="struts.objectFactory" value="spring" />这话就是说在xml被容器tomcat读取时,让Spring 来进行管理。

struts.xml的配置 变成如下:

<package name="default" namespace="/" extends="struts-default">

<action name="initsystem" class="initsystem">
   <result name="success">/Jsp/index.html</result>
  </action>

</package>

Spring的配置applicationContext-actions.xml中关于action类的配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
 xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
 xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
 <bean id="initsystem" class="com.yc.webexam.actions.InitSystemAction" scope="prototype" >
 
 </bean>


</beans>

posted @ 2014-01-31 17:23  完结。  阅读(283)  评论(0编辑  收藏  举报