tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <j...@kewlstuff.co.za>
Subject Re: How to read environment entry?
Date Wed, 27 Jun 2007 12:56:13 GMT
Hi Liz,

I think you have to get it back using something like this
Context initCtx = new InitialContext();
Context envCtx = (Context ) initCtx.lookup("java:comp/env");
String myString = (DataSource) envCtx.lookup("env/NameOfString");

The above is a guess.... you will need to read up on JNDI resources.

Just really wanted to say that you seem to be relying on the Admin tool, and 
wanted you to note that its absent from TC6... so if you upgrade, you wont 
be able to do it, and then the XML is just as much hassle.

I would also consider normal system properties.
You get then back as System.getProperty("whatever");
but they can be set in many places.

- From another program
- In the -D parameter when java starts, or when TC starts.
- If you using MS TC server... in the Service Panel -> Under Java Options (I 
think you may like that)

Have fun





----- Original Message ----- 
From: "Bachler, Elisabeth (Elisabeth)" <ebachler@alcatel-lucent.com>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Wednesday, June 27, 2007 1:48 PM
Subject: RE: How to read environment entry?


Thank you I will have a look at it.


-----Original Message-----
From: David Delbecq [mailto:delbd+jakarta@oma.be]
Sent: miércoles, 27 de junio de 2007 12:44
To: Tomcat Users List
Subject: Re: How to read environment entry?

Read doc on environment entries in tomcat context documentation:

http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

En l'instant précis du 27/06/07 12:28, Bachler, Elisabeth (Elisabeth) 
s'exprimait en ces termes:
> Hi,
> I have an application and I need to specify a string (that will be
> different in each site), so the header I am using in each jsp page
> will be able to read it and show it..... I could do it using web.xml
> but I was wondering if it was possible to do it using, in the Tomcat
> server tool (context (application) ==> Resources ==> Environment
> entries) to add a new envt entry such headerApp... And read it in each jsp 
> file ...
> How?
>
> Thanks
> Elisabeth
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
> e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, 
e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message