<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 風人園 閱讀(585) 評論(0)  編輯  收藏 所屬分類: JSF

    主站蜘蛛池模板: 黄网址在线永久免费观看 | 亚洲成AV人片在线播放无码| 亚洲精品无码少妇30P| 在线观看免费人成视频| 亚洲不卡1卡2卡三卡2021麻豆| 亚洲精品成a人在线观看☆| 99re热免费精品视频观看 | a毛片成人免费全部播放| 亚洲午夜精品一级在线播放放| 亚洲精品在线免费观看视频| 成人婷婷网色偷偷亚洲男人的天堂| a级毛片在线视频免费观看| 黄色成人免费网站| 亚洲av无码久久忘忧草| 好大好深好猛好爽视频免费| 亚洲国产欧美国产综合一区 | 久久国产福利免费| 亚洲国产第一站精品蜜芽| 亚洲av无码日韩av无码网站冲| **俄罗斯毛片免费| 亚洲色欲一区二区三区在线观看| 亚洲性无码AV中文字幕| 99久久精品国产免费| 亚洲人成在久久综合网站| 永久久久免费浮力影院| 一级成人生活片免费看| 亚洲av色影在线| 国产精品久久久久久久久久免费 | 久久亚洲AV成人无码国产| 毛片A级毛片免费播放| 午夜肉伦伦影院久久精品免费看国产一区二区三区 | 久久精品蜜芽亚洲国产AV| 性xxxx视频播放免费| 五月婷婷免费视频| 国产成人免费网站在线观看| 2022国内精品免费福利视频| 亚洲男女一区二区三区| 四虎国产精品永久免费网址| 色老板亚洲视频免在线观| 亚洲欧洲精品成人久久奇米网| 国产天堂亚洲精品|