views:

32

answers:

1

Hi all.

Is there a way to set a specific location where the ResourceBundleViewResolver should look for the view.properties files?

By specific location I mean somewhere not inside the classpath but anywhere in the file system / network resource.

Thanks in advance.

A: 

It doesn't have to be in WEB-INF/classes, it just has to be somewhere on the classpath, and WEB-INF/classes is usually the most convenient place.

If you want to put it somewhere else, then you're free to do so, as long as it's in the "root" on the classpath, e.g. inside a JAR under WEB-INF/lib.

Furthermore, it doesn't have to be called views.properties, it can be anything you like. Read the javadoc for ResourceBundleViewResolver.setBaseName():

Set a single basename, following ResourceBundle conventions. The default is "views".

ResourceBundle supports different suffixes. For example, a base name of "views" might map to ResourceBundle files "views", "views_en_au" and "views_de".

Note that ResourceBundle names are effectively classpath locations: As a consequence, the JDK's standard ResourceBundle treats dots as package separators. This means that "test.theme" is effectively equivalent to "test/theme", just like it is for programmatic java.util.ResourceBundle usage.

So it can be anywhere in the classpath you like. ResourceBundleViewResolver is a lot more flexible than you're giving it credit for - it pays to read the documentation.

skaffman
Ok, Maybe I didn't expressed the question the correct way, but I meant "specific path" that means, not inside the classpath but anywhere in the file system or any network resource. I also used the views.properties name because its the default name. I did read the doc, that's why I asked, because the doc doesn't mention a way to do that.I edited the question to clarify.
Chepech