| Author |
Can you set a global FacesMessage on a required component?
|
Rob Micah
Ranch Hand
Joined: Aug 30, 2011
Posts: 89
|
|
|
I have an h:inputText component in my facelet with the "required" attribute set to true. Is there a way to set a global FacesMessage for when this fails? It sets one for the component by default.
|
 |
Hebert Coelho
Ranch Hand
Joined: Jul 14, 2010
Posts: 754
|
|
Put this in your prorpeties file.
javax.faces.component.UIInput.REQUIRED="My Global Message"
|
[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
|
 |
Hebert Coelho
Ranch Hand
Joined: Jul 14, 2010
Posts: 754
|
|
|
Here you can find more... http://svn.apache.org/repos/asf/myfaces/core/trunk/shared/src/test/resources/javax/faces/Messages.properties
|
 |
Rob Micah
Ranch Hand
Joined: Aug 30, 2011
Posts: 89
|
|
Right now I'm not getting a global message at all even though I have
at the top of my facelet. However I do have
underneath the h:inputText it corresponds to.
So I do get a message just not a global one.
|
 |
Rob Micah
Ranch Hand
Joined: Aug 30, 2011
Posts: 89
|
|
|
To be more specific what I am asking is, why am I not already seeing a global message for this error even though I have an h:messages tag in my facelet with the globalOnly attribute set to true?
|
 |
Cesar Loachamin
Ranch Hand
Joined: Dec 25, 2010
Posts: 90
|
|
Hi Rob
Remove the globalOnly=true, that is wrong, when you set this attribute to true you only show messages not associated with a commponent, the global messages are added using the FacesContext.addMessage.
Kind regards
César.
|
When a dream is ending because to come true - OCPJP 6,7. OCE JPA EE6. MCTS
|
 |
 |
|
|
subject: Can you set a global FacesMessage on a required component?
|
|
|