Customizing a Validator Message Part II

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:

  1. Add code like the following (the prerender method is a good place to put it):
    textField1.setRequiredMessage();
    
  2. Click inside the parentheses, then right-click and choose Tools > Internationalization > Insert Internationalized String from the pop-up menu.

  3. Browse to your properties bundle and set the desired values in the dialog box.

  4. 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.

Comments:

Post a Comment:
Comments are closed for this entry.
About

divas

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today