Customizing a Validator Message Part II
By divas on Nov 17, 2006
In our last blog, we showed you how to override the standard validator message with a component-specific message. But what if you want to get the message from a properties bundle. Here is how:
- Add code like the following (the prerender method is a good place to put it):
- Click inside the parentheses, then right-click and choose Tools > Internationalization > Insert Internationalized String from the pop-up menu.
- Browse to your properties bundle and set the desired values in the dialog box.
- Click OK.
The IDE inserts code like the following:
textField1.setRequiredMessage(java.util.ResourceBundle. getBundle("custommessage/MyResources"). getString("TextRequired"));
Thanks to Greg for teaching me how to do this.