Accessing i18n properties file from “webcontent” o

2019-09-03 10:05发布

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?

标签: jsp jstl
1条回答
Luminary・发光体
2楼-- · 2019-09-03 11:00

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:

查看更多
登录 后发表回答