Showing date in masked input

UI Components for JSF
Post Reply
yan
Posts: 3
Joined: 23 Sep 2010, 16:16

23 Sep 2010, 16:36

Hi,

I'm using version 2.2.M1.
I'm trying to use masked input to take in the user's date of birth. Masked input works fine for the storing part.

I used this to store the birthdate:

Code: Select all

<p:inputMask value="#{createApplicantManagedBean.date}" mask="99/99/9999"
                                 required="true" style="font-size:small"
                                 requiredMessage="Please enter date of birth." id="dob"/>
...
...

private String date; //from masked input
private Date birthDate;
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
birthDate = (Date) df.parse(date);
personalDetails.setBirthDate(birthdate);
However, I am unable to show the stored date correctly. For example, the stored value is '12/12/1990' but '12/00/0000' is showed.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 53 guests