My Personal Online Recycle Bin
You may find something useful here...........

Monday, January 09, 2006

Java Server Face - Validate Date

If you did look into the java server face tag, you will notice there is always f:validate.... tag to do validation. That make me thought there is no validator tag for date format.

But I strongly feel that is not truth because validate date format is a very common behaviour. JSF should have provide this feature.

After some times, I noticed that f:convertDateTime tag should be used to validate date/time format. The name is really confusing me.

<h:inputtext id="textfield" value="#{bean.property}">
<f:convertdatetime pattern="dd/MM/yyyy">
</h:inputText>
<h:message for="textField">


Beside that, I found the following url is useful jsf resource.
1)MyFaces
2)JSF FAQ

1 Comments:

  • Validation is different from conversion, validation does not permit the form to be submitted if an error occurr, the conversion cannot be "valid" (as you do not respect the pattern) but this will not break the submission of the form, in the date field you get a null value and maybe your DataLogic will have some problem.

    By Anonymous Anonymous, at 6:14 PM  

Post a Comment

<< Home