I'm making a software practice for college and I'm trying to make a login form, but the managed bean seems that does not receive the user and password values.
Here is the view:
<ui:define name="content">
<h:form align="center" bgcolor="#E1E1E1">
<h:outputText value="Correu electrònic: "/>
<h:inputText id = "email" value="#{login.email}" required="true"/>
<br/><br/>
<h:outputText value="Contrasenya: "/>
<h:inputText type="password" id = "password" value="#{login.password}" required="true"/>
<br/><br/>
<h:commandButton value="Login" immediate ="true" action="#{login.login}"/>
</h:form>
</ui:define>
This is my ManagedBean:
package managedbean;
import java.io.Serializable;
import ejb.UserFacadeRemote;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
@ManagedBean(name = "login")
@SessionScoped
public class LoginMBean implements Serializable{
private static final long serialVersionUID = 1L;
@EJB
private UserFacadeRemote userRemote;
private String password;
private String email;
public LoginMBean() throws Exception { }
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String login() throws Exception {
System.out.println("User 1 - " + this.email + " P - " + this.password);
}
The answer in console when I push the login button is:
11:58:45,997 INFO [stdout] (http-localhost-127.0.0.1-8080-3) User 1 - null P - null