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

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

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

    隨筆 - 170  文章 - 536  trackbacks - 0
    <2006年9月>
    272829303112
    3456789
    10111213141516
    17181920212223
    24252627282930
    1234567

    常用鏈接

    我參與的團隊

    隨筆分類(103)

    搜索

    •  

    積分與排名

    • 積分 - 414020
    • 排名 - 135

    最新評論

    閱讀排行榜

    看到 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,但是做的并不好,現(xiàn)在 Spring 2.0 給我們提供了這樣的能力,經(jīng)過實驗,證明了這樣是可行的。

    不過如果使用 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

    注釋或刪掉以下內(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:

    ??? 這個是 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 的能力,我的第一個設(shè)想就是用 AOP 來處理 Backing Bean 中的異常,今后幾天我會繼續(xù)做這方面的實踐了。

    posted on 2006-09-05 10:16 steady 閱讀(3582) 評論(2)  編輯  收藏 所屬分類: JSF & Myfaces

    FeedBack:
    # re: JSF without ManagedBean 2006-09-12 16:19 dzzhu
    最近我也在考慮jsf的exception統(tǒng)一處理的問題,jsf沒有提供像struts和webwork提供的那些exception定向功能。

    http://forum.java.sun.com/thread.jspa?threadID=765655
    這篇帖子部分的討論了解決辦法,用servlet filter,定制lifecycle,navigationhandler,ActionListener等,AOP應(yīng)該也是一種解決方法,MBean的getter我想就不用對應(yīng)了,考慮對應(yīng)shale的prerender等幾個action就OK了。  回復(fù)  更多評論
      
    # re: JSF without ManagedBean 2008-02-02 11:47 ghost
    實際上我自己是這樣實現(xiàn)的,將帶有狀態(tài)數(shù)據(jù)的類似prototype類型的對象被JSF配置,而類似于singleton的帶有操作方法的對象(不依賴于數(shù)據(jù))被Spring配置,這樣Spring就不會牽涉到WEB層的request,response,session等對象,這樣可以保證松耦合  回復(fù)  更多評論
      
    主站蜘蛛池模板: 亚洲?V乱码久久精品蜜桃 | 国产日产成人免费视频在线观看 | 国产亚洲色婷婷久久99精品91| 亚洲av专区无码观看精品天堂| 每天更新的免费av片在线观看| 色拍自拍亚洲综合图区| 鲁大师在线影院免费观看| 亚洲国产成人久久综合一 | 免费在线观影网站| 精品久久香蕉国产线看观看亚洲| 免费无码av片在线观看| 婷婷亚洲综合五月天小说| 性色午夜视频免费男人的天堂| 久久久久久亚洲精品中文字幕| 久久久久久久岛国免费播放| 亚洲色偷偷av男人的天堂| 99久久99久久精品免费看蜜桃| 亚洲AV成人噜噜无码网站| 拍拍拍又黄又爽无挡视频免费| 国产精品无码亚洲一区二区三区| 四虎影视永久免费观看地址 | 亚洲日韩国产精品无码av| 无码乱肉视频免费大全合集| 亚洲人成自拍网站在线观看| 特级淫片国产免费高清视频| 一级毛片不卡免费看老司机| 亚洲av永久无码精品秋霞电影影院| 中文字幕亚洲免费无线观看日本 | 久久精品亚洲综合| 一色屋成人免费精品网站| 国产精品亚洲专区无码唯爱网| 国产亚洲精品自在线观看| 最近中文字幕免费完整| 国产成人精品日本亚洲直接| 性做久久久久免费看| 中文在线观看国语高清免费| 亚洲国色天香视频| 亚洲第一成人影院| 99re6在线精品视频免费播放| 亚洲.国产.欧美一区二区三区| 亚洲av无码精品网站|