0
votes

When I call a managed bean action like this

@ManagedBean(name="method")
public class Meth {
    public String vamos(){
        return "vamos";
    }
}

from a JSF file like this

<h:form>
    <h:commandButton action="#{method.vamos()}" value="vamos!"/>
</h:form>

I get the below error message:

Unable to find matching navigation case with from-view-id '/index.xhtml' for action '#{method.vamos()}' with outcome 'vamos'.

I looked up and there are different questions with my same issue but they have different solutions.

1
The code looks fine for JSF 2.x. Only the fact that you're using JSP, which is deprecated since JSF 2.x, and that implicit navigation support was only added in JSF 2.x, suggests that you're actually using JSF 1.x and not JSF 2.x. In that case you should not look for JSF 2.x targeted answers, but for JSF 1.x ones. Nonetheless, always always mention exact JSF impl/version in your JSF questions. See also stackoverflow.com/tags/jsf/infoBalusC
I'm using jsf, sorry i mistypeduser6008337
Uh, are you new to JSF? JSF can use either JSP or XHTML as view.BalusC
I'm learning it, i'm using a xhtml fileuser6008337
Again, all the code looks fine. How exactly are you certain that you're using JSF 2.x and that there is a physical /vamos.xhtml file as indicated by the error message?BalusC

1 Answers

-1
votes

The return value "vamos" is used by JSF to determine which view should be viewed next. You need to define a matching navigation case.