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

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

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

    隨筆-7  評論-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 的配置,另外的話,我們可以對 JSF 的 Backing Bean 使用 AOP 以及 Spring 提供的很多功能。過去在 JSF-Spring 中嘗試著去控制 Spring Bean 的 Scope,但是做的并不好,現在 Spring 2.0 給我們提供了這樣的能力,經過實驗,證明了這樣是可行的。

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

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

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

    2. 因為使用的是 Servlet 2.4,所以要在 web.xml 中加入
        <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

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

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 91亚洲国产成人精品下载| 亚洲AⅤ视频一区二区三区| 黄视频在线观看免费| 亚洲狠狠婷婷综合久久久久| fc2成年免费共享视频18| 亚洲性色成人av天堂| 中国亚洲女人69内射少妇| 免费一区二区视频| 最近免费中文字幕大全视频| 91高清免费国产自产| 丁香花在线视频观看免费| 欧美好看的免费电影在线观看| 国产精品免费大片一区二区| 永久免费精品影视网站| 国产精品亚洲专区无码唯爱网| 四虎影视精品永久免费| 国产成人无码a区在线观看视频免费| 国产h视频在线观看免费| 久久久久久免费视频| 国产h视频在线观看网站免费| 18女人水真多免费高清毛片| 亚洲成人免费在线| 国产桃色在线成免费视频 | 好吊妞在线成人免费| 女人18毛片水真多免费看 | 永久免费无码网站在线观看个| 一个人晚上在线观看的免费视频| 精品无码国产污污污免费网站国产| 一级做α爱过程免费视频| 大地资源在线资源免费观看 | 中文字幕无码日韩专区免费| **俄罗斯毛片免费| 国产午夜鲁丝片AV无码免费| 亚洲色成人网站WWW永久| 亚洲三级中文字幕| xxxxx做受大片视频免费| 天天摸夜夜摸成人免费视频| 色噜噜亚洲精品中文字幕| 亚洲欧美国产国产一区二区三区| 国产成人无码精品久久久免费| 中文字幕影片免费在线观看|