Natraj
Natraj

Reputation: 417

Accessing i18n properties file from "webcontent" or "WEB-INF\local" folder

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?

Upvotes: 0

Views: 1191

Answers (1)

BalusC
BalusC

Reputation: 1109432

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 basename local.filename instead of filename.

See also:

Upvotes: 3

Related Questions