2 Replies Latest reply on Apr 21, 2010 2:15 PM by jabailo

    Best way to store property strings

    jabailo

      I have a set of key strings that I use in a java bean, called by my jsp pages.

       

      I want these keys to reside in text so they can be changed without recompiling.

       

      However, they will rarely change.

       

      I thought about putting them in a properties file that would be read by my bean.

       

      However, I didn't think the properties file should be reloaded with each and every user.

       

      Is there any globally accessible resource that is loaded once on startup where I could put these properties?

       

      Should I use web.xml?   Would a bean in an external package be able to access web.xml?

        • 1. Re: Best way to store property strings
          peterj

          Here are a few possibilities:

           

          Use the properties service. See rghe properties-service.xml file in the deploy directory.

           

          Place the properties file in the conf directory. That directory is in the classpath for every web app.

          • 2. Re: Best way to store property strings
            jabailo

            I ended up using a managed-bean-property in one project, which works really well.

             

            But I'm still looking for a method in my "unmanged" bean (see my other thread).

             

            I will look into what you suggest.