Displaying Error messages dynamically in JSF
Hi,
Ques: How to display/set error messages dynamically ?
Here is the sample code:
private void create()
{
TextField t = new TextField();
t.setId();
getGridPanel1().getChildren().add(t);
t.setRequired(true);
Message m1 = new Message();
m1.setFor(name);
getGridPanel1().getChildren().add(t);
}
we got error message like "Validation Error: Value is required.", but we want to set/create error message dynamically.
Regards,
Zubeir
[537 byte] By [
Zubeira] at [2007-11-27 7:59:09]

# 2
Not sure what you are doing here but this is not how validation messages work. There is a property file around (have to look it up specifically) that has all of the standard JSF error messages in it. These would be thrown by the standard validators provided by JSF.
Now you can change the property file and supply your own message for the default JSF errors.
Or you can write your own validator (I suggest using validator methods, so much easier) that does its own check and generates the appropriate message that you want to show back to the user.