views:

39

answers:

2

How do you setup a navigation rule based on a function with parameters in SEAM ?

For example

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

Thanks

+1  A: 

It is possible,

But... from-action signature must match your commandButton, commandLink, etc action attribute

Suppose your command is shown as follows

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

...

Now your navigation

<page view-id="/firstPage.xhtml" back="enabled">
    <navigation from-action="#{actionBean.fetchItem(index)}">
        <redirect view-id="/itemDetail.xhtml" />
    </navigation>
</page>
Arthur Ronald F D Garcia
Certainly does work in the way you described, although I ended up using what @Bozho suggested. Thanks!
John
A: 

I don't get it why do you need a parameter, when you are going to have one outcome for all parameters.

If it is indeed what you want - well, then don't use any parameters.

If you want to execute the action and then return to the view - well, you can return the appropriate String from your action method.

Bozho