锘??xml version="1.0" encoding="utf-8" standalone="yes"?>青青草久久爱,亚洲国产视频一区二区,欧美一区二区精品久久911http://www.aygfsteel.com/daniel007/category/2849.html鐧藉垏闈㈢墖JAVA涔嬭礬zh-cnTue, 06 Nov 2007 16:46:40 GMTTue, 06 Nov 2007 16:46:40 GMT60JSF without ManagedBeanhttp://www.aygfsteel.com/daniel007/archive/2007/11/05/158337.html鐧藉垏闈㈢墖鐧藉垏闈㈢墖Mon, 05 Nov 2007 11:43:00 GMThttp://www.aygfsteel.com/daniel007/archive/2007/11/05/158337.htmlhttp://www.aygfsteel.com/daniel007/comments/158337.htmlhttp://www.aygfsteel.com/daniel007/archive/2007/11/05/158337.html#Feedback0http://www.aygfsteel.com/daniel007/comments/commentRss/158337.htmlhttp://www.aygfsteel.com/daniel007/services/trackbacks/158337.htmlJSF without ManagedBean

鐪嬪埌 Shale 鐨?Spring Integration 鏂囨。鐨勪粙緇嶅師鐞嗭紝鍏朵腑欏哄簭濡備笅錛?/font>

When asked to resolve a variable name, the following algorithm is performed:

1.Does a bean with the specified name already exist in some scope (request, session, application)? If so, return it.

2.Is there a standard JavaServer Faces managed bean definition for this variable name? If so, invoke it in the usual way, and return the bean that was created.

3.Is there configuration information for this variable name in the Spring WebApplicationContext for this application? If so, use it to create and configure an instance, and return that instance to the caller.

4.If there is no managed bean or Spring definition for this variable name, return null instead.

榪欐牱鐨勮瘽錛屽彧瑕?Spring 鍙互鎺у埗 Bean 鐨?Scope 鐨勮瘽錛屽氨鍙互鎶?Managed-Bean 鐨勯厤緗斁鍒?Spring Bean 閲屾潵閰嶇疆錛屼竴鏂歸潰錛屾垜浠彲浠ョ渷鍘諱簡 JSF 鐨?Managed Bean 鐨勯厤緗紝鍙﹀鐨勮瘽錛屾垜浠彲浠ュ JSF 鐨?Backing Bean 浣跨敤 AOP 浠ュ強 Spring 鎻愪緵鐨勫緢澶氬姛鑳姐傝繃鍘誨湪 JSF-Spring 涓皾璇曠潃鍘繪帶鍒?Spring Bean 鐨?Scope錛屼絾鏄仛鐨勫茍涓嶅ソ錛岀幇鍦?Spring 2.0 緇欐垜浠彁渚涗簡榪欐牱鐨勮兘鍔涳紝緇忚繃瀹為獙錛岃瘉鏄庝簡榪欐牱鏄彲琛岀殑銆?/font>

涓嶈繃濡傛灉浣跨敤 Spring Bean 浠ュ悗錛屼細閫犳垚浣跨敤 Managed Bean 鐨?JSTL 鏃犳硶浣跨敤錛屽叾瀹?JSTL 鏈韓鐢ㄨ搗鏉ュ氨鏃跺ソ鏃跺潖鐨勶紝鎵浠ュ獎鍝嶅茍涓嶅お澶т簡銆?/font>

鏁村悎璧鋒潵姝ラ闈炲父鐨勭畝鍗曪細

1. 鎶?Spring 2.0 鐨?jar 鏂囦歡鏀懼埌 lib 涓嬮潰錛屽綋鍓嶄嬌鐢ㄧ殑鏄?Spring 2.0 RC3

2. 鍥犱負浣跨敤鐨勬槸 Servlet 2.4錛屾墍浠ヨ鍦?web.xml 涓姞鍏?br />     <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

3. 淇敼 applicationContext.xml

娉ㄩ噴鎴栧垹鎺変互涓嬪唴瀹癸細

  <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
  "
http://www.springframework.org/dtd/spring-beans.dtd ">

淇敼 <beans> 涓猴細

  <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 "
       xsi:schemaLocation="
 
http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd
  http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd ">

4. 鐒跺悗灝卞彲浠ユ寜鐓ч厤緗?Spring Bean 鐨勬柟寮忔潵閰嶇疆 Managed Bean:

    榪欎釜鏄?Request Scope 涓殑 Bean:
    <bean id="loginBean" class="org.agilejava.icustomer.backingbean.LoginBean"
          scope="request" autowire="byName">
        <aop:scoped-proxy/>
    </bean>

    榪欎釜鏄?Session Scope 涓殑 Bean:
    <bean id="menuBean" class="org.agilejava.framework.commons.menu.MenuBackingBean"
          scope="session" autowire="byName">
        <aop:scoped-proxy/>
    </bean>

铏界劧鐭湡鏉ョ湅錛岄厤緗笂浼氬皯鍐欎簡涓浜涳紝鍥犱負 autowire="byName"錛屼絾鏄粠闀胯繙鏉ョ湅錛屾垜浠彲浠ュ埄鐢?Spring 鐨勬洿澶氬姛鑳斤紝姣斿 AOP 鏉ュ寮?Backing Bean 鐨勮兘鍔涳紝鎴戠殑絎竴涓鎯沖氨鏄敤 AOP 鏉ュ鐞?Backing Bean 涓殑寮傚父.good



]]>
主站蜘蛛池模板: 大足县| 大名县| 凌海市| 永吉县| 从江县| 广宗县| 三河市| 隆回县| 扶风县| 承德县| 呈贡县| 九江县| 怀来县| 松桃| 广饶县| 达日县| 乐清市| 改则县| 西乌珠穆沁旗| 吐鲁番市| 珠海市| 都安| 扶沟县| 清镇市| 台湾省| 高碑店市| 洞口县| 略阳县| 扎囊县| 怀安县| 天祝| 迁安市| 西盟| 集安市| 桃园市| 广元市| 抚州市| 盐山县| 白银市| 连平县| 温州市|