现在的位置: 首页 > 综合 > 正文

Spring整合Struts2方式二:使用自动装配

2013年10月01日 ⁄ 综合 ⁄ 共 1168字 ⁄ 字号 评论关闭

承接上篇文章,将需要改动的地方列出来:

struts.xml :

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
    "http://struts.apache.org/dtds/struts-2.1.7.dtd">

<struts>
    <package name="demo" extends="struts-default">
        <action name="add" class="com.action.AddDeptAction">
            <result>/ok.jsp</result>
        </action>
    </package>
</struts>

beans.xml :

<?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:context="http://www.springframework.org/schema/context"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="http://www.springframework.org/schema/beans 

http://www.springframework.org/schema/beans/spring-beans-2.5.xsd


http://www.springframework.org/schema/context


http://www.springframework.org/schema/context/spring-context-2.5.xsd


http://www.springframework.org/schema/tx


http://www.springframework.org/schema/tx/spring-tx-2.5.xsd


http://www.springframework.org/schema/aop

                http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
    
    <bean id="deptDao" class="com.dao.DeptDAOImpl"/>
    
 </beans>

抱歉!评论已关闭.