How to change ADF default messages
These are some requirement on which we want to change the
default adf error messages.
I am explaining the way here using that you can change the
ADF default error messages.
Default Adf Messages:
There are different way of doing this :
- Using Property File
- Using ListResourceBundle
Using Property File
Steps need to follow for using the property file:
- Create a property file like Messages_en.properties
- Add the below lines in faces-config.xml
Property
file is as follows
org.apache.myfaces.trinidad.UIXEditableValue.REQUIRED=You
must enter value for this fields.
org.apache.myfaces.trinidad.UIXEditableValue.REQUIRED_detail=Value
is required in order to submit form.
Using
ListResourceBundle
- Create the java class which extends from ListResourceBundle
- Code for java class are as follows:
public class CustomMessageBundle extends
ListResourceBundle
{
@Override
public Object[][] getContents()
{
return new Object[][] { {
"org.apache.myfaces.trinidad.UIXEditableValue.REQUIRED", "You
must enter value for this fields" },{
"org.apache.myfaces.trinidad.UIXEditableValue.REQUIRED_detail",
"Value
is required in order to submit form." } };
}
}
3.
Add this file to resource bundle like
After Error Message look like:
Sample Application can be found on click here