Miguel,

 

I'm assuming you want to access the values as defined for a given
parameter in your server.xml or in your web.xml files depending on
whether you want them defined globally or per application.

 

Try the folling code in your jsp file and replace the parameter name
with the appropriate one.

 

<<BEGIN CODE SNIPET>>

   String my_var = "";

   try

   {

      InitialContext initCtx      = new InitialContext();

      if(initCtx == null) throw new Exception("Boom - No Context");

      //Context envContext = (Context) initialContext.lookup
("java:comp/env");

      Context envCtx              =
(Context)initCtx.lookup("java:comp/env");

              my_var            = (String)
envCtx.lookup("my_parameter_name");

   }

   catch(Exception e) 

   {

      out.println(e.getMessage());

      e.printStackTrace();

   }

<<END CODE SNIPET>>

 

/JM

 

-----Original Message-----
From: Miguel Vieira [mailto:[EMAIL PROTECTED] 
Sent: 25 September 2003 12:35
To: [EMAIL PROTECTED]
Subject: Accessing GlobalNamingResources

 

Hi,

 

I'm using Tomcat 4.1.19 and I'd like to know if it's possible to access 

the GlobalNamingResources, defined in server.xml, from a servlet, 

without creating a ResourceLink in the servlet's context?

 

Thanks,

Miguel Vieira

 

 

---------------------------------------------------------------------

To unsubscribe, e-mail: [EMAIL PROTECTED]

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

 

Reply via email to