2011-10-24 71 views
0

我在JSF1.2頁面上有一個名爲cancel的h:commandButton按鈕,當用戶按下此按鈕時,他應該被重定向到同一頁面。 JSF1.2如何實現?導航到JSF1.2中的相同頁面

回答

2

首先記住要設置immediate="true"屬性,默認情況下,標籤將調用所有驗證器等,然後調用應用程序。

您的按鈕:

<h:commandButton value="cancel" action="cancel" title="Cancel this page" /> 

你的臉,context.xml中:

<navigation-rule> 
    <from-view-id>index.xhtml</from-view-id> 
    <navigation-case> 
     <from-outcome>cancel</from-outcome> 
     <to-view-id>index.xhtml</to-view-id> 
     <redirect/> 
    </navigation-case> 
</navigation-rule> 
+0

我也一樣,但它不工作。 – Adnan

+0

你的'commandButton'被'h:form'標籤包圍了嗎? –

+0

no commandButton不在h:form標籤中,因此它不起作用。在將命令按鈕放入h後:現在它正在工作,非常感謝。 – Adnan