Oct 13th, 2010, 06:13 AM
Reading values stored in properties file from JSP
Is there a standard Spring webmvc mechanism to read from a properties file in JSP pages? I'm happy to do this in a controller and pass the values as part of the model. But then I have to deal with the following:
- cache properties
- poll file for changes (this isn't so important for me)
Basically I have properties files for various environments my app runs in (dev, production, sandbox, etc). Wondering if there's a standard Spring way to deal with this.
Oct 13th, 2010, 08:17 AM
Check out this appendix in Spring documentation for the spring.tld tag library. There's a message tag for retrieving values from properties files. It's used for internationalization, but you could use it for what you're after too.
Oct 13th, 2010, 05:54 PM
Interesting, we do use <fmt:message> extensively from the JSTL for internationalization. Never thought about using it for environment properties as well... Seems like it should work, but I'd prefer to have a specific properties file or location for environment settings. We dynamically generate our i18n properties files..
Originally Posted by pgrimard
Tags for this Thread