Search code examples
javajsfnavigationseam

SEAM navigation based on function with parameters


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>

Solution

  • 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>