0

I've followed the steps answered in similar SO questions and also in other sites like Mkyong with no success. I'm describing below what I've done so far in order to customize the javax.faces.component.UIInput.REQUIRED:

  1. Create MyMessages.properties in formularis.utils.missatges.custom package and customize the error:

    javax.faces.component.UIInput.REQUIRED = This value is required.
    
  2. Copy MyMessages.properties and translate to my languages:

    MyMessages.properties
    MyMessages_ca_ES.properties
    MyMessages_es_ES.properties
    MyMessages_en_US.properties
    
  3. Declare the properties file in faces-config:

    <application>
        <locale-config>
            <default-locale>ca_ES</default-locale>
            <supported-locale>ca_ES</supported-locale>
            <supported-locale>es_ES</supported-locale>
            <supported-locale>en_US</supported-locale>
        </locale-config>
        <message-bundle>formularis.utils.missatges.custom.MyMessages</message-bundle>
    </application>
    

Am I missing any configuration or declaration? I don't understand why my application doesn't show my custom error messages. Thank you in advance.

Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
jmrodrigg
  • 600
  • 6
  • 24
  • do you get any errors in the log or console? – roel Dec 10 '12 at 13:51
  • Nope. It shows the default error message `form_id:component_id: Validation Error: Value is required.`, not my customized message. – jmrodrigg Dec 10 '12 at 14:12
  • @jmrodrigg Have you placed your property file in your Container's `config` folder ? – Vikas V Dec 11 '12 at 04:02
  • 1
    The tutorial link in your post is for JSF 2.0, not for JSF 1.2. – Luiggi Mendoza Dec 11 '12 at 05:30
  • @LuiggiMendoza Can't it be applied to JSF 1.2? I've been reading different articles that suggest this same idea and I would say I've read some of them referring to JSF 1.2. At least they don't specify that the solution only works for JSF 2.0 and above. If you confirm that, I would give up trying this solution... but can you suggest any approach that would not represent a manually change in every component? – jmrodrigg Dec 11 '12 at 08:23
  • @VikasV No, the property file is located inside my webapp as I only want to customize my webapp's error messages. – jmrodrigg Dec 11 '12 at 08:56
  • @jmrodrigg Ok. Can you please post your code where on using the JSF component you are trying to print this customized error. For eg., `` I have this customized error message which works in JSF 1.2, but here I have placed the property file in Container's config folder. I never gave a try by not placing it there – Vikas V Dec 11 '12 at 12:32

0 Answers0