In server.xml, under <DefaultContext>:

   <Environment name="foo" type="java.lang.String" value="bar"/>

And in web.xml:

   <env-entry>
     <env-entry-name>foo</env-entry-name>
     <env-entry-type>java.lang.String</env-entry-type>
   </env-entry>

And the code to get it back (include javax.naming.*):

   Context initCtx = new InitialContext();
   Context envCtx = (Context) initCtx.lookup("java:comp/env");
   String jndiFoo = (String)envCtx.lookup("foo");

Cheers,
-Josh

--

Max Power, he's the man who's name you'd love to touch! But you mustn't touch!
His name sounds good in your ear, but when you say it, you mustn't fear!
'Cause his name can be said by anyone!


     [ Josh 'G-Funk' McDonald ]  --  [ Pirion Systems, Brisbane]

[ 07 3257 0490 ]  --  [ 0415 784 825 ]  --  [ http://www.gfunk007.com/ ]

----- Original Message ----- From: "Josh G" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, June 30, 2004 4:22 PM
Subject: <environment> values in server.xml



Where should I put <environment> values in server.xml? And more importantly, how on earth do I retrieve them programmatically? The documentation on this sort of stuff is either unbelievably inadequate or incredibly hard to find.


Or c) I'm a dickhead. Either way, I could really use a hand. I'm just trying to get a string out of server.xml - not web.xml.

Cheers,
-Josh

--

Max Power, he's the man who's name you'd love to touch! But you mustn't touch!
His name sounds good in your ear, but when you say it, you mustn't fear!
'Cause his name can be said by anyone!


     [ Josh 'G-Funk' McDonald ]  --  [ Pirion Systems, Brisbane]

[ 07 3257 0490 ]  --  [ 0415 784 825 ]  --  [ http://www.gfunk007.com/ ]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to