1
votes

I have some problem with JSF dynamic navigation. I'm using JSF 2.2 version. I'm trying to organize dynamic navigation

<h:commandButton value="Enter" action="loginController.result">

LoginController.java

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class LoginController implements Serializable {

private static final long serialVersionUID = 1L;

public String result(){
    return "register";
}

}

And it doesn't work. When I try to go to needed page it writes:" Unable to find matching navigation case with from-view-id '/index.xhtml' for action 'loginController.result' with outcome 'loginController.result'". I tryed to return "register.xhtml","\register.xhtml","\register" etc. But it didn't work too. When I write:

<h:commandButton value="Enter" action="register">

It is working as it should. I know what the way to make it working exists. Please, help me.

1

1 Answers

3
votes

You have to use an EL expression so JSF will invoke your JSF bean method:

<h:commandButton value="Enter" action="#{loginController.result}">

Otherwise the value of the action attribute would be interpreted as a string literal, that's why you see it working when you use action="register".