首页 > 其他 > 详细

spring_Struts2 xml配置

时间:2014-02-01 12:30:50      阅读:462      评论:0      收藏:0      [点我收藏+]

要让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>

spring_Struts2 xml配置

原文:http://www.cnblogs.com/hqqcoffee/p/3504398.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!