3 Replies Latest reply on May 5, 2004 12:22 PM by Raja

    properties from a file

    jan_marien Newbie

      Is there an easy way to read some properties from a file.

      maybe you can pass some things within the web.xml or something
      or use something like "getResource()" (used in servlets)

      What shall I use in JBoss, are there any examples with a solution?

        • 1. Re:  properties from a file
          tperrigo Newbie

          If these are properties you need to access within an EJB, consider using environment entries in the bean's deployment descriptor. For example, to create an integer property called "foo" with the value of 28 add the following to the ejb-jar.xml file:


          Hope this helps

          • 2. Re:  properties from a file
            pjrichter Newbie

            How are these entries accessed? Also, what if the same entry also needs to be accessed by a jsp?

            • 3. Re:  properties from a file
              Raja Master

              Create a Singleton that would be kicked off from a load-on-startup servlet. This wud read a proprties using getResource() and store it as a singleton or jndi if clustered. Once u have it, u can access from ejb, jsp, whatever.
              Ofcourse, this is just one way, there are multitude of patterns available to solve this