views:

467

answers:

1

I am new to JSF. I do not understand how to create my own messages properties files and where exactly to put this file. Can anyone help me with this?

+2  A: 

I am not getting how to create new my own properties file

Create a text file according the java.util.Properties contract. ISO-8859-1 encoded text with key=value pairs, each in its own line. In case of JSF message resource, you can use the key names as described in the JSF specification to override default messages. You can find them in chapter 2.5.2.4 of the JSF specification (here are the JSF 1.2 specification and JSF 2.0 specification).

and where to put this file under directory

Just put it in the classpath as you do with your normal Java classes.

The <message-bundle> in faces-config.xml file should refer to the full qualified pathname of the resource. If you've named the properties file Messages.properties and just dropped in the root of the classpath, then its declaration should look like

<application>
    <message-bundle>Messages</message-bundle>
</application>

But if you've dropped it in for example the package com.example.i18n, then it should look like:

<application>
    <message-bundle>com.example.i18n.Messages</message-bundle>
</application>
BalusC
Hey Balu thanks..
praddy