I am developing a JSP / Servlet pages which needs to be i18n. The example codes which I have seen on the internet are using JSTL's setlocal and setbundle tags. And they are adding the .properties
file in the java source folder or WEB-INF\classes
folder.
I am using Apache Tomcat 6.0.32 and JSTL1.2 jar files for the project.
I wanted to know can we added the .properties
file in say webcontent\i18n
or WEB-INF\local
folder. And access it using JSTL tags?
It has to go in the classpath. They're under the covers loaded by
ResourceBundle
which loads them by default form the classpath. So, putting it outside the classpath won't work. You can always put them in a (sub)package like so/WEB-INF/classes/local/filename.properties
. You should then only access it with basenamelocal.filename
instead offilename
.See also: