Writing a custom validator in JSF 2 is not a complicated task. You implement Validator interface, add @FacesValidator annotation and insert validator declaration in faces-config.xml, that’s all. A piece of cake. But let’s consider following scenario:
You need custom date validator, let’s say checking that date from rich:calendar is not in the past. So we place calendar component with validator inside.
<rich:calendar value="#{fieldValue}" id="dateField" datePattern="yyyy/MM/dd">
<f:validator validatorId="dateNotInThePast"/>
</rich:calendar>

