2010-04-13 84 views
2

如何在SEAM中基於帶參數的功能設置導航規則?基於帶參數功能的SEAM導航

例如

<page view-id="/firstPage.xhtml" back="enabled"> 
    <navigation from-action="#{actionBean.fetchItem(int index)}"> 
     <redirect view-id="/itemDetail.xhtml" /> 
    </navigation> 
</page> 

回答

3

這是可能的,

但是... 從行動簽名必須匹配您的commandButton,commandLink等行動屬性

假設您的命令如下所示

<h:commandButton action="#{actionBean.fetchItem(index)}" value="Submit index"/> 

...

現在你的導航

<page view-id="/firstPage.xhtml" back="enabled"> 
    <navigation from-action="#{actionBean.fetchItem(index)}"> 
     <redirect view-id="/itemDetail.xhtml" /> 
    </navigation> 
</page> 
+0

確實按照你描述的方式工作,儘管我最終使用了@Bozho的建議。謝謝! – John 2010-04-13 22:58:26

0

爲什麼你需要一個參數,當你將有一個結果爲所有參數我不明白這一點。

如果確實是你想要的 - 那麼,不要使用任何參數。

如果您要執行操作然後返回到視圖 - 那麼您可以從操作方法返回適當的String