河流(River)的专栏

duming115的技术博客

杜明ID:duming115
13875次访问,排名7911(-5)好友0人,关注者1
喜欢编程,也喜欢看一些编程的书
duming115的文章
原创 31 篇
翻译 14 篇
转载 68 篇
评论 4 篇
最近评论
duming115:1.索引页面是指索引页面中的文字,索引标签来说没有意义,不过搜索引擎会根据文字所在的不同标签内进行区域划分,比如标题等.
2.跟踪页面中的链接,是指的页面的pr值的传递,每个页面(url地址)都有一个pr值,这些pr值会传递给页面中的链接.
3.页面快照应该是指的google的搜索结果中的网页快照吧,应该是google的缓存.
sunshinebailin:学习了,只是有一些术语不太明白,如索引当前页面指的是索引页面的文字,还是页面元素?还有跟踪当前页面中所有的链接是什么意思?还有保存页面快照是什么东东?
psnccs:Wow gold
psnccs:Wow gold
文章分类
收藏
    相册
    seo--搜索引擎优化
    seobook
    搜索引擎优化SEO每天一贴_zac的博客
    点石互动
    我的好友
    健康快乐每一天
    邹可见的技术博客
    存档
    订阅我的博客
    XML聚合  FeedSky

    翻译 jsf in action 笔记:通过值绑定初始化Bean(Setting values with value-binding expressions)--2008.04.15 收藏

    新一篇: jsf in action 笔记:在页面的海洋中导航(3.4 Navigating the sea of pages)--2008.04.16 | 旧一篇: 工作中的笔记:删除多个表中的关联记录--2008.04.15

    2008.04.15 摘自  JSF in action  3.3.3 Setting values with value-binding expressions  Page/159

    1.  JSF 中可以通过使用JSF 的EL(Expression Language)语言来引用之前创建的Managed Bean来初始化当前Managed Bean的属性,EL表达式放在#{...}中,具体的语法同组件上的EL表达式一样,可以参考之前的<jsf in action 笔记:页面语言(Expression Language)--2008.04.09  >,这种值绑定(value-binding)的方式与Spring中的依赖注入(Dependence Injection)模式有相同之处.以下为.xml配置文件中的示例代码:以下为示例图:

    <managed-bean>
    <managed-bean-name>defaultFavoriteSites</managed-bean-name>
    <managed-bean-class>java.util.ArrayList</managed-bean-class>
    <managed-bean-scope>none</managed-bean-scope>注: 没有放入到任何的scope中<list-entries>
    <value>http://www.jsfcentral.com</value>
    <value>http://www.theserverside.com</value>
    <value>http://www.ibm.com/developerworks/</value>
    <value>http://otn.oracle.com</value>
    <value>http://www.java.net</value>
    <value>http://www.manning.com</value>
    </list-entries>
    </managed-bean>
    <managed-bean>
    <description>Default user object.</description>
    <managed-bean-name>newUser</managed-bean-name>
    <managed-bean-class>org.jia.examples.UserBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>注:存放在session的scope中
    <managed-property>
    <property-name>favoriteSites</property-name>
    <value>#{defaultFavoriteSites}</value>注:引用value binding的方式引用的defaultFavoriteSites这个上面创建的Managed Bean
    </managed-property>
    <managed-property>
    <property-name>favoriteAnimal</property-name>
    <value>donkey</value>
    </managed-property>
    </managed-bean>
    <managed-bean>
    <managed-bean-name>exampleForm</managed-bean-name>
    <managed-bean-class>org.jia.examples.TestForm</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>注:存放在request的scope中
    <managed-property>
    <property-name>user</property-name>
    <value>#{newUser}</value>注:采用value binding 引用newUser Managed Bean
    </managed-property>
    </managed-bean>

    exampleForm对象中的user属性指向的是存放在session中的用户newUser,newUser的favoriteSites属性是之前创建的defaultFavoriteSites这个对象,defaultFavoriteSites这个对象不存在于任何一个scope(application,session,request)中,它的值被设定为none,(原文: Because defaultFavoriteSites is declared in the scope none, it isn’t stored anywhere—it’s created solely for the purposes of setting newUser’s favoriteSites property.)它只为这个newUser单独创建,?:就是不知道是不是为每个用户都创建一次.下面为以上代码的示例图:

    JSF Setting values with value-binding expressions

    2.  采用JSF EL初始化Bean的属性有几条规则:

    • bean中的属性指的对象的生存跨度(scope值)不应该比bean本身的生存跨度(scope值)短,应该符合下列表中的规定:

      An object stored in this scope…

      Can reference an object stored in this scope…

      none

      none

      application

      none, application

      session

      none, application, session

      request

      none, application, session, request

      ,就像上面的示例代码中exampleForm references newUser,This is okay, because newUser is stored in the session and exampleForm is stored in the request. newUser的生存跨度要比exampleForm的长,因为当一次请求及响应结束后,exampleForm就会被清除了,但是newUser还在,而且活的很开心(When the request is completed and exampleForm is removed, newUser will continue to live happily.),用户还会继续其它的一些操作.但如果newUser中存放了exampleForm这个对象,当newUser想去对exampleForm进行操作的时候,exampleForm可能已经被清除了,所以这样是不允许的.
    • JSF 也不支持环状,即A中引用B,B中引用A.
    • JSF的值绑定配置给我们配置对象的初始值提供了很大的便利,可以在不修改代码的条件下修改其初始值.

    发表于 @ 2008年04月15日 22:40:00|评论(loading...)|编辑

    新一篇: jsf in action 笔记:在页面的海洋中导航(3.4 Navigating the sea of pages)--2008.04.16 | 旧一篇: 工作中的笔记:删除多个表中的关联记录--2008.04.15

    评论:没有评论。

    发表评论  


    当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
    Csdn Blog version 3.1a
    Copyright © 河流(River)--duming115