How can I use a method which takes parameters as a navigation action in faces-config.xml

157 Views Asked by At

I am trying to navigate user according to the return value of a method. I am already doing it using methods needing no parameter like

public String save() { ... }

by

<navigation-case>
    <from-action>#{someBean.save}</from-action>
    <from-outcome>history</from-outcome>
    <to-view-id>/pages/history.xhtml</to-view-id>
    <redirect/>
</navigation-case>

But when I try that with a method which has signature

public String repeat(Order baseOrder)

with

<navigation-case>
    <from-action>#{someBean.repeatOrder}</from-action>
    <from-outcome>success</from-outcome>
    <to-view-id>/pages/orders.xhtml</to-view-id>
    <redirect/>
</navigation-case>

it does not redirect. What might be the reason and solution?

EDIT:

I edited the method so that it will return a more particular String than "success" such as "repeat-success" and used

<navigation-case>
    <from-outcome>repeat-success</from-outcome>
    <to-view-id>/pages/orders.xhtml</to-view-id>
    <redirect/>
</navigation-case>

which I do not specify any methods and it works fine now.

0

There are 0 best solutions below