Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Mohammad Noor Najdawi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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


 
Tim Holloway
Bartender
Posts: 18661
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!