Purpose: Modify the default error message the error message displayed for each type of verification error is controlled by the message. properties file, which is located in the javax. Faces package in the jsf-impl.jar. You can view the following information to expand libraries> Sun Java System Application Server> Jsf-impl.jar> Javax. FacesAnd double-click Messages. Properties. You can create a custom message by replacing the property file used by the application. 1. Right-click the jastrologer project and choose new> file/folder. In the other category, select properties file and click Next. Name the file mymessages and enter the folder location: Src/Java/astrologer/UI And then clickFinish. Mymessages. Properties The file is displayed in the source code editing area. In Files Window to expand folders Src/Java/astrologer/UI To view files.2. Extract the following attributes from Messages. Properties Copy Mymessages. Properties Medium:
javax.faces.component.UIInput.REQUIRED={0}: Validation Error: Value is required.
javax.faces.converter.DateTimeConverter.DATE={2}: ''{0}'' could not be understood as a date.
javax.faces.converter.DateTimeConverter.DATE_detail={2}: ''{0}'' could not be understood as a date. Example: {1}3. Modify the attribute value:
javax.faces.component.UIInput.REQUIRED=Please enter a value for this field.
javax.faces.converter.DateTimeConverter.DATE=Please enter a valid date.
javax.faces.converter.DateTimeConverter.DATE_detail=Please enter a valid date. Example: {1}4. Open Faces-config.xml(Under the configuration files node in the projects window), and enter the following content under the main element of faces-config:
...
<application>
<message-bundle>astrologer.ui.MyMessages</message-bundle>
</application>
</faces-config>
5. Right-click the application and select Run project. If you do not enter any information in the required field or enter an incorrect date format in the birthday input box, the following error message is displayed. Note: Information that is not specified in the custom property file will be obtained from messages. properties in the jsf-impl.jar. Similarly, you can specify a CSS style for the error message and specify the style in the message tag as follows.
This part of content can be referenced on page 1. Book: Java ee 5 practical tutorial