validation and empty fields

I want to put a different message than "value is required" when user leaves a field empty.I know that a method in a bean for validation will not be called if field is empty. However I need to print a different message than "value is required". How can I do that?

More also can someone please explain me what the following code represents?

((UIInput)toValidate).setValid(false);

because thetoValidate cannot be recognised in my code.

Thanking you in advance...

[531 byte] By [juanitaJa] at [2007-11-26 15:29:26]
# 1
Put following in your bundles to replace the default message.javax.faces.component.UIInput.REQUIRED=<Your message>
jaguar2010a at 2007-7-8 21:45:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Ok I did that.But because I have many components I want to have messages such as :

-Name is required

-Age is required

So I thought of adding in my Errors.properties the following:

javax.faces.component.UIInput.REQUIRED={0} is required

But I do not know where to define this {0} in my jsp . I tried to do the following but it didn't work

<h:inputText id="name" required="true" value="#{user.name}">

<f:param value=" Name field"/>

</h:inputText>[

Any suggestions?

juanitaJa at 2007-7-8 21:45:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
I dont think there is a way to do it like this. You have to write your custom validator to achieve that and generate your desired messages through it.
jaguar2010a at 2007-7-8 21:45:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
You can do this with a PhaseListener.See an example at http://www.oracle.com/technology/pub/articles/masterj2ee/j2ee_wk7.html.(the "Adding Meaningful Field References" section)
bugmenotbugmenota at 2007-7-8 21:45:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Ok thank you very much.
juanitaJa at 2007-7-8 21:45:44 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...