Unfortunately, the spec isn't very good on this matter.
Basically, you'll have to override the spec and provide custom
functionality to be able to achieve this.
Isn't this something we could do in the MyFaces custom components?
The reason you can't do this within the spec is that the Validation
exception that is created for empty UIInputs that are required is
created inside UIInput. Unfortunately, there is no way to change the
String that the template message uses in its "{0}" place without
overriding UIInput's validate() method. This, of course, means that
you would have to create extensions to all UIInputs
(HtmlSelectOneRadio, HtmlSelectOneListbox, HtmlInputText, etc).
Perhaps someone with a little clout (i.e. Craig, Manfred), could
suggest this to the spec guys, since I've tried to do so on the
forums, but it has fallen on deaf ears.
On Fri, 03 Dec 2004 11:56:02 -0700, Matt Raible <[EMAIL PROTECTED]> wrote:
> I would like to change the validation messages to be a bit more
> friendly, like they are with Commons Validation and Struts/Spring.
> Basically, instead of:
>
> "firstName": Value is required.
>
> I'd like it to say "First Name is a required field."
>
> I have the following in my resource bundle, but it doesn't give me
> access to the field's label (i18n-ized).
>
> javax.faces.component.UIInput.REQUIRED={0} is a required field.
>
> Instead it prints:
>
> firstName is a required field.
>
> Any idea how to look up a input field's label and use the text from that
> in the {0}?
>
> Thanks,
>
> Matt
>
>
--
If you don't have a GMail account, I probably have 5 invites. Just ask!
-Heath Borders-Wing
[EMAIL PROTECTED]