加入導覽規則

請參閱  

導覽規則會根據使用者嘗試登入 Crystal Enterprise 是否成功,來定義要採取的導覽動作;導覽規則根據傳回字串的登入嘗試是否成功,將使用者重新導向到不同頁面。導覽規則在 [Properties] 檢視中設定,並自動儲存在 faces-config.xml 檔案中。

設定登入元件的導覽規則
  1. 開啟 logon.jsp,並在 visual designer 中選取 [Logon] 元件。
  2. 在 [Properties] 檢視中,按一下 [Add Rule] 按鈕。
  3. 在 [Add Navigation Rule] 視窗中,將頁面設定到 contents.jsp。在標題「當動作傳回結果:」之下,選取 [命名結果] 選項,輸入 logon_success,接著按一下 [確定]
  4. 在 [Properties] 檢視中,再按一下 [Add Rule] 按鈕。
  5. 在 [Add Navigation Rule] 視窗中,將頁面設定到 logon.jsp。在標題「當動作傳回結果:」之下,選取 [命名結果] 選項,輸入 logon_failure,接著按一下 [確定]

您現在必須建立執行檢查使用者登入狀態的動作方法,並傳回字串「logon_success」或「logon_failure」。

將動作方法加至登入元件
  1. 開啟 logon.jsp,並在 visual designer 中選取 [Logon] 元件。
  2. 在 [Quick Edit] 檢視中,按一下 [Command] 選項。
  3. 將下列方法輸入到 [Quick Edit] 視窗:
  4. identity = getIdentity();

    if (identity == null)

    return "logon_failure";

    if(!identity.isLoggedOn())

    return "logon_failure";

    return "logon_success";

這個方法會檢查含有使用者工作階段資訊的 Identity Bean 是否存在,以及其登入狀態。如果 Identity Bean 不是 Null,但已登入 Crystal Enterprise,就會傳回「logon_success」字串;反之,若使用者未登入,則會傳回「logon_failure」字串。



Business Objects
http://www.taiwan.businessobjects.com/
支援服務
http://www.businessobjects.com/services/support/