锘??xml version="1.0" encoding="utf-8" standalone="yes"?>性高爱久久久久久久久,日韩一区二区在线看,性xx色xx综合久久久xxhttp://www.aygfsteel.com/sofia888888/濂嬫枟姣zh-cnSat, 21 Jun 2025 13:11:23 GMTSat, 21 Jun 2025 13:11:23 GMT60spring2鍜宻truts2鏁村悎http://www.aygfsteel.com/sofia888888/archive/2008/11/03/238435.html嬈ч槼浜?/dc:creator>嬈ч槼浜?/author>Mon, 03 Nov 2008 13:31:00 GMThttp://www.aygfsteel.com/sofia888888/archive/2008/11/03/238435.htmlhttp://www.aygfsteel.com/sofia888888/comments/238435.htmlhttp://www.aygfsteel.com/sofia888888/archive/2008/11/03/238435.html#Feedback0http://www.aygfsteel.com/sofia888888/comments/commentRss/238435.htmlhttp://www.aygfsteel.com/sofia888888/services/trackbacks/238435.html
鍦⊿truts2涓暣鍚圫pring鐨処oC鏀寔鏄竴浠跺崄鍒嗙畝鍗曠殑浜嬫儏銆傝鎴戜滑涓姝ヤ竴姝ユ潵瀹炵幇錛?br />     1錛夊鍒秙truts2-spring-plugin-x-x-x.jar鍜岀浉搴旂殑spring.jar鍒?WEB-INF/lib鐩綍涓嬨?br />     2錛夊湪struts.properties涓緗畇truts.objectFactory灞炴у?


    struts.properties
    struts.objectFactory = spring
    鎴栬呮槸鍦╔ML鏂囦歡涓繘琛屽父閲忛厤緗?

    struts.xml
    <struts>
        <constant name="struts.objectFactory" value="spring" />
    </struts>
    3錛夐厤緗甋pring鐩戝惉鍣?

    web.xml
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    閫氳繃Spring閰嶇疆鏉ユ敞鍐屽璞?

    applicationContext.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC
        "-//SPRING//DTD BEAN//EN"
        "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans default-autowire="autodetect">
        <bean id="hello" class="hpfyeah.struts2.spring.HelloWorldAction"/>
    </beans>
    褰撶劧浣犱篃鍙互鎷ユ湁鏇村鐨凷pring閰嶇疆鏂囦歡銆傚湪web.xml涓繘琛屼笅鍒楄緗紝浠庤屼嬌Spring鐨凙pplicationContext閫氳繃鍖歸厤鎵緇欏畾妯″紡鐨勬枃浠舵潵鍒濆鍖栧璞?

 

    web.xml
    <!-- 鐢ㄦ潵瀹氫綅Spring XML鏂囦歡鐨勪笂涓嬫枃閰嶇疆 -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml
        </param-value>
    </context-param>
    4錛変慨鏀逛綘鐨凷truts閰嶇疆鏂囦歡

    struts.xml
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
    <struts>
        <include file="struts-default.xml"/>
        <package name="default" extends="struts-default">
            <action name="pureStruts" class="hpfyeah.struts2.spring.HelloWorldAction">
                <result>hello.jsp</result>
            </action>
            <action name="springStruts" class="hello">


                <result>hello.jsp</result>
            </action>
    </struts>
    榛樿鎯呭喌涓嬶紝Spring浠庝笂闈㈡樉紺虹殑applicationContext.xml鏂囦歡涓鎵句負hello鎵鍋氱殑閰嶇疆 杞歡寮鍙戠綉 www.mscto.com

 

5錛夊ソ浜嗭紝鐜板湪浣犵殑Struts2鍜孲pring灝辮兘姝e父鐨勪竴璧峰伐浣滀簡銆傛湁鍑犱釜閰嶇疆鎶鏈偣闇瑕佽緇嗚鏄庝笅錛?br />     瑁呴厤妯″紡銆備綘鍙互閫氳繃璁劇疆淇敼struts.properties涓笅鍒楀睘鎬х殑鍊兼潵鏀瑰彉瑁呴厤妯″紡銆?

 

    name 鎸夌収浣犵殑action鐨勫睘鎬х殑鍚嶅瓧鍜孲pring閲岀殑bean鐨勫悕瀛楀尮閰嶏紝濡傛灉鍖歸厤灝辮嚜鍔ㄨ閰嶃傝繖鏄己鐪佺殑
    type 鎸夌収浣犵殑action鐨勫睘鎬х殑綾誨瀷錛屽湪Spring娉ㄥ唽鐨刡ean涓煡鎵撅紝濡傛灉鐩稿悓灝辮嚜鍔ㄨ閰嶃傝繖闇瑕佷綘鍦⊿pring涓粎娉ㄥ唽浜嗕竴涓綾誨瀷鐨刡ean
    auto Spring浼氳瘯鍥捐嚜鍔ㄧ洃嫻嬫潵鎵懼埌鏈濂界殑鏂規硶鑷姩瑁呴厤浣犵殑action
    constructor Spring浼氳嚜鍔ㄨ閰峛ean鐨勬瀯閫犲嚱鏁扮殑鍙傛暟

 


    鏄惁浣跨敤綾葷紦瀛樸備綘鍙互閫氳繃璁劇疆淇敼struts.properties涓笅鍒楀睘鎬х殑鍊兼潵鏀瑰彉鏄惁浣跨敤Spring鑷韓鐨勭被緙撳瓨鏈哄埗銆傚彲浠ヨ瀹氱殑鍊間負true鎴杅alse錛岄粯璁や負true銆?

    struts.properties
    struts.objectFactory.spring.useClassCache = false

]]>
主站蜘蛛池模板: 马尔康县| 军事| 肇州县| 东兰县| 泰安市| 铜川市| 吴江市| 民县| 德江县| 盐边县| 新源县| 开阳县| 盐源县| 民县| 台州市| 岱山县| 育儿| 藁城市| 浙江省| 平遥县| 浮山县| 青神县| 浏阳市| 克山县| 花莲市| 阿克苏市| 抚州市| 湘西| 和林格尔县| 即墨市| 赤城县| 堆龙德庆县| 洞口县| 金昌市| 清原| 社会| 阳高县| 丹阳市| 呼玛县| 临沂市| 庐江县|