How to use Resource Bundle in JSF?

  • Topic : Java Server Faces (JSF)
  • Environment : J2EE 5.0, MyFaces 1.1.5

Resource Bundle in JSF

also read:

This section explain how to use message resources in Java Server Faces (JSF). Resource Bundles are very important when comes to internationalization.JSF framework provides simple way to configure and use th message resources in your application. Follow the steps to configure resource-bundle:

  • Step :1 Create a properties file. In our example we have created
  • Step :2 Add message-bundle element in the faces-config.xml. for more details see the complete program in the example section.
  • Step :3 Load the bundle using f:loadBundle tag in jsp file.
  • Step :4 Use the “msg” varible (which is defined while loading the message bundle) in the tags to get message resources.


   Source :

<f:loadBundle basename="net.javabeat.myfaces.resource.ApplicationResources" var="msg"/>
            <h:form id="resources">
                <h:outputFormat value="#{msg.testMessage1}">
                    <f:param value="Apple"/>
                    <f:param value="Google"/>
                <h:outputLabel value="#{msg.testMessage2}"/>



# Sample ResourceBundle properties file
testMessage1={0} and {1} is most innovative companies in IT
testMessage2=Google - The internet God



About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

  • Ahmed Ali

    Hi Krishna
    I have a little confusion over and . What is the use of both? How many ways we can configure those 2 bundles in jsf 1.2 version? plz mail