• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

can i change the name of the ValidationMessages.properties to any name i want? if yes, HOW?

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,
i am using hibernate validation + JSR 303 validation with JSF 2 and RichFaces 4

when i add annotations on my bean attributes, i get the messages from the ValidationMessages.properties on the default (root) package, assume the case as folllow:

class MyBean{
@NotEmpty(message="{Name_Error_Message}")
private String name;
// rest of code here
}

ValidationMessages.properties
Name_Error_Message = The name cannot be empty

my question is: can i change the name of the ValidationMessages.properties to any name i want? if yes, HOW?

Regards.

Mohd Noor


 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohammad Noor Najdawi wrote:
my question is: can i change the name of the ValidationMessages.properties to any name i want? if yes, HOW?



Almost certainly, and you can also almost certainly define and use multiple validation messages or even I18N message bundles. You would do that as an option setting in your web.xml file. However what the name and use of that option setting would be would require me to RTFM. Fortunately, this isn't that uncommon a request, so it's probably not going to be too hard to find out.

BTW, JSF message bundle locations are defined in the faces-config file, but you're asking about general validation, and I'm pretty sure that the location definitions for them do go in web.xml.
 
Mohammad Noor Najdawi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks so much,
i am relatively new to web development; i didn't get the idea clearly, but i had searched on the internet about how to change the name, and i didn't found anything.
so can you help me and told me how to change ValidationMessages.properties name and how to make it available by default when a property from it(newName.Properties), used in annotation message

what i need to add in web.xml?
 
Always look on the bright side of life. At least this ad is really tiny:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic