Good afternoon, I am learning Java EE and between practice and practice I have come across an error that I can not solve, it is but they can help me to continue with my learning process. The error he gives me is this:
/index.xhtml @ 23,111 value="# {student.nombre}": The class 'videotutoriales.PrimeFaces.alumno' does not have a readable property 'name'.
I tried to change the annotations but it does not occur to me that it may be wrong, here I leave part of my code:
<?xml version='1.0' encoding='UTF-8' ?>
<body>
<ui:composition template="./plantilla.xhtml">
<ui:define name="top">
<h2>Datos personalizados de alumnos</h2>
</ui:define>
<ui:define name="content">
<h:form>
<p:messages/>
<p:panel header="Escribir informacion del alumno">
<h:panelGrid columns="2">
<h:outputLabel for="nombre" value="Nombre " styleClass="requiredLbl"/>
<h:inputText id="nombre" label="Nombre" value="#{alumno.nombre}" required="true"/>
<h:outputLabel for="primerApellido" value="Primer Apellido"/>
<h:inputText id="primerApellido" label="Primer Apellido" value="#{alumno.primerApellido}"/>
<h:outputLabel for="segundoApellido" value="Segundo Apellido"/>
<h:inputText id="segundoApellido" label="Segundo Apellido" value="#{alumno.segundoApellido}"/>
<h:outputLabel for="fechaNacimiento" value="Fecha de Nacimiento"/>
<p:calendar id="fechaNacimiento" value="#{alumno.fechaNacimiento}"
showOn="button" navigator="true"/>
<h:panelGroup/>
<p:commandButton value="Enviar"
action="#{alumnoController.salvarAlumno}"
ajax="false"/>
</h:panelGrid>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</body>
and the managedbean that I'm using is just getter and setter and I'll leave it below:
package videotutoriales.PrimeFaces;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
/**
*
* @author Ana Sofia
*/
@Named(value = "alumno")
@RequestScoped
public class alumno {
/**
* Creates a new instance of alumno
*/
public alumno() {
}
private String nombre;
private String primerApellido;
private String segundoApellido;
private Date fechaNacimiento;
private final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
public String getFechaNacimiento(){
String fechaNacimientoFormateada = "";
if(fechaNacimiento != null){
fechaNacimientoFormateada = sdf.format(fechaNacimiento);
}
return fechaNacimientoFormateada;
}
public void setFechaNacimiento(Date fechaNacimiento){
this.fechaNacimiento = fechaNacimiento;
}
public String nombre(){
return nombre;
}
public void setNombre(String nombre){
this.nombre = nombre;
}
public String getPrimerApellido(){
return primerApellido;
}
public void setPrimerApellido(String primerApellido){
this.primerApellido = primerApellido;
}
public String getSegundoApellido(){
return segundoApellido;
}
public void setSegundoApellido(String segundoApellido){
this.segundoApellido = segundoApellido;
}
}
Thanks in advance.