In this article, I show you code examples on how to handle dates in JSF forms.

The project consists of three files:
– StudentTest.java
– student_date_test_form.xhtml
– student_date_test_response.xhtml

The user enters the student data into the form: first name, last name and hire date. The input format for the hire date is day, month, year. As an example For 1 May 2016, you would enter: 1-5-2016.

form

Once the form is submitted, then the app will show the output.

result

 

Here’s the code. Enjoy!


File: StudentTest.java


File: student_date_test_form.xhtml


File: student_date_test_response.xhtml