0

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.

ybalcanci
  • 93
  • 1
  • 7
  • Navigation cases in XML are leftover of legacy JSF 1.x and unnecessary in JSF 2.x. Why exactly are you still using them? – BalusC Aug 29 '19 at 11:28
  • It is being used in the project that I involved in recently, It was not my choice. – ybalcanci Aug 29 '19 at 11:33
  • Then just drop it? Simply let your method return `/pages/orders.xhtml?faces-redirect=true` instead of `success` as per JSF 2.x rules. – BalusC Aug 29 '19 at 11:35

0 Answers0