<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-7  評(píng)論-13  文章-2  trackbacks-0

    看到 Shale 的 Spring Integration 文檔的介紹原理,其中順序如下:

    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 的配置,另外的話,我們可以對(duì) JSF 的 Backing Bean 使用 AOP 以及 Spring 提供的很多功能。過去在 JSF-Spring 中嘗試著去控制 Spring Bean 的 Scope,但是做的并不好,現(xiàn)在 Spring 2.0 給我們提供了這樣的能力,經(jīng)過實(shí)驗(yàn),證明了這樣是可行的。

    不過如果使用 Spring Bean 以后,會(huì)造成使用 Managed Bean 的 JSTL 無法使用,其實(shí) JSTL 本身用起來就時(shí)好時(shí)壞的,所以影響并不太大了。

    整合起來步驟非常的簡單:

    1. 把 Spring 2.0 的 jar 文件放到 lib 下面,當(dāng)前使用的是 Spring 2.0 RC3

    2. 因?yàn)槭褂玫氖?Servlet 2.4,所以要在 web.xml 中加入
        <listener>
            <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
        </listener>

    3. 修改 applicationContext.xml

    注釋或刪掉以下內(nèi)容:

      <!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:

        這個(gè)是 Request Scope 中的 Bean:
        <bean id="loginBean" class="org.agilejava.icustomer.backingbean.LoginBean"
              scope="request" autowire="byName">
            <aop:scoped-proxy/>
        </bean>

        這個(gè)是 Session Scope 中的 Bean:
        <bean id="menuBean" class="org.agilejava.framework.commons.menu.MenuBackingBean"
              scope="session" autowire="byName">
            <aop:scoped-proxy/>
        </bean>

    雖然短期來看,配置上會(huì)少寫了一些,因?yàn)?autowire="byName",但是從長遠(yuǎn)來看,我們可以利用 Spring 的更多功能,比如 AOP 來增強(qiáng) Backing Bean 的能力,我的第一個(gè)設(shè)想就是用 AOP 來處理 Backing Bean 中的異常.good

    posted on 2007-11-05 19:43 白切面片 閱讀(320) 評(píng)論(0)  編輯  收藏 所屬分類: 軟件工程

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 久久水蜜桃亚洲AV无码精品| 亚洲视频免费播放| 成人免费在线看片| 亚洲女同成av人片在线观看| 久久久久免费视频| 欧洲亚洲国产清在高| 亚洲第一男人天堂| 日韩精品福利片午夜免费观着| 免费在线观看污网站| 粉色视频成年免费人15次| 国产成人综合久久精品免费 | 在线看片免费人成视频播| 久久综合AV免费观看| 亚洲日韩国产一区二区三区在线| 久久精品一区二区免费看| 精品亚洲麻豆1区2区3区| www免费插插视频| 精品少妇人妻AV免费久久洗澡 | 亚洲乱人伦精品图片| a级毛片免费高清毛片视频| 亚洲国产精品无码久久一区二区| 99精品一区二区免费视频| 97se亚洲国产综合自在线| 2021在线观看视频精品免费| 亚洲狠狠婷婷综合久久久久| 精品无码专区亚洲| 久久久久国产亚洲AV麻豆| 污网站在线免费观看| 久久久青草青青国产亚洲免观| 免费人成网站在线观看不卡| 亚洲综合网站色欲色欲| 国产男女爽爽爽免费视频 | 亚洲宅男精品一区在线观看| 国产在线19禁免费观看国产| 最新久久免费视频| 亚洲成人在线免费观看| 精品无码国产污污污免费网站 | 国产成人久久AV免费| 美女视频黄免费亚洲| 国产黄色一级毛片亚洲黄片大全| 免费大片av手机看片|