Message Bundles

Message Bundles

  • When you implement a web application, it is a good idea to collect all message strings in a central location. 
  • This process makes it easier to keep messages consistent. 
  • You collect your message strings in a file:
  • Exa: 
guessNext = Guess the next number in the sequence!.       
Answer=Your Answer:
  • Save the file together with your classes. 
  • You can choose any directory path and filename but you must use the extension .properties. 
  • Exa: messages.properties 


You can declare a message bundle in two ways.

  • Way-1 faces-config.xml
  • Way-2 Global resource bundle declaration


Message Bundle File

  • The collection of  all message strings in a central location


1. Way-1 faces-config.xml


In JSF File (xhtml)


2. Way-2 Global resource bundle declaration

Thanks a lot for query or your valuable suggestions related to the topic.

Previous Post Next Post

Contact Form