Question

I have the following :

<p:inputText id="login"
             value="#{userBean.login}"
             required="true"
             label="Login"
             widgetVar="log">
 <f:validateLength minimum="1"/>
</p:inputText>

I need to override the input components message for all jsf required validation.

default : "Login : erreur de validation. Vous devez indiquer une valeur."

custom : "Login : est requis."

i have already created a properties file in the com.app.foo named Messages containing the following lines :

javax.faces.component.UIInput.REQUIRED = Saisie invalide.
javax.faces.component.UIInput.REQUIRED_detail = {0}: est requis.   

Also i have registered it in the faces-config with the line below :

<message-bundle>
    com.app.foom.Messages
</message-bundle>

Yet i still get the default required validation message.

Was it helpful?

Solution

Just mention the attribute requiredMessage to inputText component and write custom message.

<p:inputText id="login" value="#{userBean.login}" required="true" 
         requiredMessage="est requis" label="Login" widgetVar="log">
    <f:validateLength minimum="1" />
</p:inputText>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top