Results 1 to 3 of 3

Thread: Reading values stored in properties file from JSP

  1. #1
    Join Date
    Feb 2008
    Posts
    169

    Question 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:
    • performance
    • 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.

  2. #2
    Join Date
    Nov 2009
    Location
    Montreal, Quebec
    Posts
    398

    Default

    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.

  3. #3
    Join Date
    Feb 2008
    Posts
    169

    Default

    Quote Originally Posted by pgrimard View Post
    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.
    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..

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •