I am new to JSF and I've read through several tutorials, however, for some reason when I try to transfer data from a form to another page, it returns null.
This is the bean
package stateless;
import javax.ejb.EJB;
import javax.inject.Named;
import javax.enterprise.context.Dependent;
@Named(value = "jsfbean")
@Dependent
public class jsfbean {
@EJB
private MyuserFacadeRemote myuserFacade;
private String username;
private String password;
private String message;
/**
* Creates a new instance of jsfbean
*/
public jsfbean() {
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMessage() {
return "Hello "+ username;
}
public void setMessage(String message) {
this.message = message;
}
}
This is the main page
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>Index</title>
</h:head>
<h:body>
<h:form>
<p>Login</p>
<h:inputText value="#{jsfbean.username}"/>
<h:commandButton action="result" value="Results Page"/>
</h:form>
</h:body>
</html>
On the result page, the only thing that is there is #{jsfbean.message} Hope someone can help