0
Error trying to register user, the following message appears:
accordion:dtNasc: '22-02-1990' could not be understood as a date.
XHTML:
<p:outputLabel class="lt" value="Data de Nascimento:" />
<p:calendar id="dtNasc" value="#{usuarioBean.funcionario.dt_nasc}" locale="pt" yearRange="-99:+39" widgetVar="dtNasc"navigator="true" showButtonPanel="true">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:calendar>
Staff Class
@NotEmpty(message = "O campo data de nascimento é obrigatório.")
@Column(name = "fun_dt_nasc", nullable = false)
private String dt_nasc;
public String getDt_nasc() {
return new SimpleDateFormat("dd/MM/yyyy").parse(getDt_nasc());
}
public void setDt_nasc(String dt_nasc) {
setDt_nasc(new SimpleDateFormat("dd/MM/yyyy").format(dt_nasc));
}
In my get it gives a mistake: Type Mismatch: cannot Convert from Date to String
What is the type of the dt_nasc attribute in the working class?
– NilsonUehara
It is String... private String dt_nasc;
– Marquin Ferreira
Calendar requires the attribute to be of the Date type
– NilsonUehara