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

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

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

    posts - 0,  comments - 0,  trackbacks - 0

    Table 2-4. Predefined Objects in the Value Expression Language
    Variable Name Meaning
    header A Map of HTTP header parameters, containing only the first value for each name.
    headerValues A Map of HTTP header parameters, yielding a String[]array of all values for a given name.
    param A Map of HTTP request parameters, containing only the first value for each name.
    paramValues A Map of HTTP request parameters, yielding a String[]array of all values for a given name.
    cookie A Map of the cookie names and values of the current request.
    initParam A Map of the initialization parameters of this web application. Initialization parameters are discussed in Chapter 10.
    requestScope A Map of all request scope attributes.
    sessionScope A Map of all session scope attributes.
    applicationScope A Map of all application scope attributes.
    facesContext The FacesContext instance of this request. This class is discussed in Chapter 6.
    view The UIViewRoot instance of this request. This class is discussed in

     Finally, if the name is still not found, it is passed to the VariableResolver of the JSF application. The default variable resolver looks up managed-bean elements in a configuration resource, typically the faces-config.xml file.

    Consider, for example, the expression

      #{user.password}


    The term user is not one of the predefined(預定義) objects. When it is encountered(遇到) for the first time, it is not an attribute name in request, session, or application scope.

    Therefore, the variable resolver processes the faces-config.xml entry:

      <managed-bean>
         <managed-bean-name>user</managed-bean-name>
         <managed-bean-class>com.corejsf.UserBean</managed-bean-class>
         <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>


    The variable resolver calls the default constructor of the class com.corejsf.User-Bean. Next, it adds an association to the sessionScope map. Finally, it returns the object as the result of the lookup.

    When the term user needs to be resolved again in the same session, it is located in the session scope


    Composite Expressions
        

    You can use a limited set of operators inside value expressions:

    Arithmetic operators + - * / %. The last two operators have alphabetic variants div and mod.

    Relational operators < <= > >= == != and their alphabetic variants lt le gt ge eq ne. The first four variants are required for XML safety.

    Logical operators && || ! and their alphabetic variants and or not. The first variant is required for XML safety.

    The empty operator. The expression empty a is true if a is null, an array or String of length 0, or a Collection or Map of size 0.

    The ternary ?: selection operator.

     Operator precedence follows the same rules as in Java. The empty operator has the same precedence as the unary - and ! operators.

     Generally, you do not want to do a lot of expression computation in web pages—that would violate the separation of presentation and business logic. However, occasionally, the presentation layer can benefit from operators. For example, suppose you want to hide a component when the hide property of a bean is true. To hide a component, you set its rendered attribute to false. Inverting the bean value requires the ! (or not) operator:

      <h:inputText rendered="#{!bean.hide}" ... />


     

    Finally, you can concatenate plain strings and value expressions by placing them next to each other. Consider, for example,

      <h:outputText value="#{messages.greeting}, #{user.name}!"/>


     

    The statement concatenates four strings: the string returned from #{messages. greeting}, the string consisting of a comma and a space, the string returned from #{user.name}, and the string consisting of an exclamation mark.


            
    上文出自:《core JavaServer™ Faces, Second Edition》

    posted on 2007-12-11 19:25 *一凡* 閱讀(146) 評論(0)  編輯  收藏 所屬分類: JSF
    主站蜘蛛池模板: 国产亚洲一区区二区在线| 亚洲国产日产无码精品| 国产精成人品日日拍夜夜免费| 久久亚洲私人国产精品vA| 免费黄色app网站| 国产精品免费在线播放| 亚洲不卡视频在线观看| 免费夜色污私人影院在线观看| 97视频免费观看2区| 亚洲国产成人AV网站| 亚洲v高清理论电影| 日韩免费观看一级毛片看看| 91精品全国免费观看青青| 亚洲欧美日韩中文字幕在线一区| 国产亚洲成人在线播放va| 在线视频免费观看高清| 国产激情久久久久影院老熟女免费| 亚洲精品在线免费观看| 亚洲精品A在线观看| 无码人妻一区二区三区免费手机 | 曰批全过程免费视频播放网站| jzzijzzij在线观看亚洲熟妇| 亚洲AV成人一区二区三区AV| 日韩一品在线播放视频一品免费| 精品亚洲永久免费精品| 国产偷国产偷亚洲高清人 | a级毛片毛片免费观看永久| 亚洲国产美女精品久久久| 亚洲一二成人精品区| 亚洲无码精品浪潮| 四虎成人精品一区二区免费网站 | 久久青草免费91线频观看不卡| 视频一区二区三区免费观看| 亚洲免费观看网站| 亚洲2022国产成人精品无码区| 深夜国产福利99亚洲视频| 好吊妞视频免费视频| 最近免费中文在线视频| 久久久久久AV无码免费网站| h片在线观看免费| 五月天国产成人AV免费观看|