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

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

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

    風人園

    弱水三千,只取一瓢,便能解渴;佛法無邊,奉行一法,便能得益。
    隨筆 - 99, 文章 - 181, 評論 - 56, 引用 - 0
    數據加載中……

    JSF--Navigate

    JSF中最重要的導航設置
    一、靜態導航
    <h:commandButton label="Login" action="login"/>
    通過action返回的字符串,然后比較   from-outcome標簽值,如果相同,就返回到   to-view-id  制定的頁面
    注: view ID strings must start with a /.
    二、動態導航
    <h:commandButton label="Login" action="#{loginController.verifyUser}"/>
    根據action中調用的bean方法返回值來確定顯示頁面
    loginController的驗證方法
    String verifyUser() {

       if (...)

          return "success";

       else

          return "failure";

    }


    三、高級導航
    Redirection
    如果你在to-view-id 后 加redirect元素,則JSP容器即中斷當前request請求,并發送一個HTTP redirect 請求到client. 
    <navigation-case>
       <from-outcome>success</from-outcome>
       <to-view-id>/success.jsp</to-view-id>
       <redirect/>
    </navigation-case>

    Wildcards(通配符)
    <navigation-rule>
       <from-view-id>/secure/*</from-view-id>
       <navigation-case>
          . . .
       </navigation-case>
    </navigation-rule>
    只要是在/secure/這個目錄下的頁面都使用這個導航規則。

    所有
    <from-view-id>/*</from-view-id>

    or
    <from-view-id>*</from-view-id>

    Using from-action
    <navigation-case>
      <from-action>#{quiz.answerAction}</from-action>
      <from-outcome>again</from-outcome>
      <to-view-id>/again.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-action>#{quiz.startOverAction}</from-action>
      <from-outcome>again</from-outcome>
      <to-view-id>/index.jsp</to-view-id>
    </navigation-case>
    根據不同的action使用不同的導航規則。

    導航算法

    The algorithm has three inputs(算法有三個輸入):

    • The outcome, that is, the value of an action attribute or the string resulting from the invocation of a method reference. action屬性的值或者引用方法的返回結果(字符串類型)

    • The view ID of the current view。當前視圖

    • The action, that is, the literal value of the action attribute in the component that triggered the navigation.用以觸發導航的組件屬性。

    The first of two phases is to find the matching navigation-rule, following these steps(第二階段的第一步就是尋找符合的導航規則).

    • If the outcome is null, return immediately and redisplay the current page.(如果outcome是空,則立刻返回重新顯示當前頁面)
    • Merge all navigation rules with the same from-view-id value.(合并相同from-view-id的導航規則)
    • Try to find a navigation rule whose from-view-id value matches the view ID exactly. If such a rule exists, take it.
    • Consider all navigation rules whose from-view-id values end with a wildcard suffix, such as secure. For each such rule, check whether the prefix (after removing the *) is identical to the corresponding prefix of the view ID. If there are matching rules, take the one with the longest matching prefix.
    • If there is a rule without a from-view-id, take it.(如果有沒有from-view-id的規則,使用)
    • If there is no match at all, redisplay the current page.(如果都沒有符合,重新顯示當前頁面)

    The second of two phases is to consider all navigation-case elements in the matching navigation rule (which may consist of several merged navigation-rule elements with matching from-view-id.values).

    Follow these steps to find the matching case.

    • If a case has both matching from-outcome and from-action, take it.
    • Otherwise, if a case has matching from-outcome and no from-action, take it.
    • Otherwise, if a case has matching from-action and no from-outcome, take it.
    • Otherwise, if there is a case with neither from-outcome or from-action, take it.
    • If there is no match at all, redisplay the current page.
      Naturally, we recommend that you do not create tricky navigation rules in your own programs. As long as you stay away from wildcards and from-action elements, you won't need to know about the gory details of the navigation algorithm.


     

    posted on 2007-04-26 15:23 風人園 閱讀(584) 評論(0)  編輯  收藏 所屬分類: JSF

    主站蜘蛛池模板: 国产乱子精品免费视观看片| 91精品国产免费| 国产男女猛烈无遮挡免费网站| 亚洲精品**中文毛片| 十八禁无码免费网站| 亚洲国产精品线在线观看| 久久精品免费视频观看| 久久久亚洲欧洲日产国码aⅴ | 久久国产乱子伦精品免费不卡| 狠狠色伊人亚洲综合成人| 免费在线看污视频| 老色鬼久久亚洲AV综合| 69天堂人成无码麻豆免费视频| 国产99在线|亚洲| 四虎影院在线免费播放| 亚洲精品天堂成人片AV在线播放| 国产成人无码a区在线观看视频免费| 国产91成人精品亚洲精品| 国产亚洲av片在线观看18女人| 亚洲免费观看视频| 亚洲性色成人av天堂| 成在线人永久免费视频播放| 人体大胆做受免费视频| 亚洲av中文无码乱人伦在线咪咕 | 亚洲av永久无码| 亚洲一区视频在线播放| 日本免费一区二区三区四区五六区| 亚洲综合久久成人69| 免费高清av一区二区三区| 一级毛片正片免费视频手机看| 亚洲第一中文字幕| 久久久久久久久免费看无码| 免费看又黄又爽又猛的视频软件 | 亚洲中文字幕一区精品自拍| 亚洲AV无码乱码在线观看| 国产一精品一AV一免费| 国产亚洲中文日本不卡二区| 亚洲国产精品尤物YW在线观看| 美丽姑娘免费观看在线观看中文版| 久久综合久久综合亚洲| 亚洲色偷拍另类无码专区|