0

Is it possible to add some binding, for example String test = "test string", through Web.xml to jndi bindings pool, to later pull it out in the way: new InitialContext.lookup("java:comp/env/test") from the code?

viavad
  • 373
  • 7
  • 17

1 Answers1

0

The answer web.xml

...
<env-entry>
        <env-entry-name>java:comp/env/string/stringVar</env-entry-name>
        <env-entry-type>java.lang.String</env-entry-type>
        <env-entry-value>value of the inserted string</env-entry-value>
</env-entry>
...

the code

...
String testString = (String) ctx.lookup("java:comp/env/string/stringVar");
...
viavad
  • 373
  • 7
  • 17