HTML and CSS Reference
In-Depth Information
When the user enters an out-of-range number and then clicks the "Proceed" command button, the following JSF
default validation error message will appear to the user:
xxx:someNumber: Validation Error: Specified attribute is not between the expected values of 10 and 100.
In order to change the message, we need to do the following:
Override the javax.faces.validator.LongRangeValidator.NOT_IN_RANGE key in the
application message bundle as follows:
javax.faces.validator.LongRangeValidator.NOT_IN_RANGE = {2}''s value must be minimum {0}
and maximum {1}.
Register the application message bundle in the faces-config.xml file as follows:
<faces-config ...>
After doing these changes in the application's message bundle and in the faces-config.xml file, after inputting
an out-of-range number in the input text and then clicking the "proceed" command button, the final error message
will be
xxx:someNumber's value must be minimum 10 and maximum 100.
In this chapter, you learned in detail the JSF validation and conversion. You know the lifecycle of the JSF conversion,
the JSF Converter interface, and the JSF standard converters, and you understand how to build custom JSF
converters. You also learned the lifecycle of the JSF validation, the JSF Validator interface, and the JSF standard
validators; how to build custom JSF validators; and finally how to work with Java Bean Validation (JSR 303) in JSF
applications. At the end of the chapter, you learned how to empower your JSF application by customizing the JSF
framework standard conversion and validation messages.
Search WWH ::

Custom Search