HTML and CSS Reference
<h:outputText value="Enter Number2: "/>
<f:validateLongRange minimum="0" maximum="999"/>
We have a form that contains two inputText components ( number1 and number2 ). Every inputText component
has two attached validators. Every input text has the following validators:
1. <f:validateRequired> , which is used to validate that the EditableValueHolder
component will not contain empty input (using the required="true" attribute has the
2. <f:validateLongRange> , which is used to validate that the value of the long integer field is
within a specified range (minimum and maximum).
<f:validateLongRange> is used in the example to verify that both input texts have a minimum value equal
to 0 and a maximum value equal to 999 . If the user enters empty values or out-of-range values in both inputText
components and then clicks the "submit" command button, the user will see two validation error messages in
both <h:message/> components that are associated with every inputText component. This explains what we said
previously that the validation in JSF (like conversion) must be applied to every component that has one or more
Standard JSF Validators
Now, let's dive into the details of the JSF standard validators. Table 3-2 shows the JSF standard validators.
Table 3-2. JSF Standard Validators
Used to validate that the EditableValueHolder (such as input text) value is required.
Setting the required="true" attribute has the same effect.
Used to validate that the EditableValueHolder value which is long integer is within
a specified range.
Used to validate that the EditableValueHolder value which is double is within a
Used to validate that the EditableValueHolder value is within the specified length
Used to validate that the EditableValueHolder value is complaint with a specified
Java regular expression.
Used to assign the EditableValueHolder local value validation to the Java Bean
Validation (JSR 303) APIs.