Why not set your context param in your webapps web.xml? 

Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Development.Multimedia.Branding
emotionalize.conceptualize.visualize.realize
Tel: +27125468436
Fax: +27125468436
email:[EMAIL PROTECTED]
web: www.volume4.com
 
This message contains information that is considered to be sensitive or
confidential and may not be forwarded or disclosed to any other party
without the permission of the sender. If you received this message in error,
please notify me immediately so that I can correct and delete the original
email. Thank you. 

:: -----Original Message-----
:: From: Jon Wingfield [mailto:[EMAIL PROTECTED]
:: Sent: Thursday, March 25, 2004 12:22 PM
:: To: Tomcat Users List
:: Subject: Re: Getting Context Parameters from server.xml
:: 
:: If you had
:: String name = config.getInitParameter("companyName");
:: it might work ;)
:: 
:: HTH,
:: 
:: Jon
:: 
:: Michael Jones wrote:
:: > Hello-
:: >
:: > I'm trying to store some values in my server.xml and then get them with
my
:: > Servlet.
:: >
:: > I followed the instructions at:
:: > http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/context.html
:: > under the "Context Parameters" section.
:: >
:: > In my servlet I got all init params and iterated over the enumeration.
The
:: > parameter I defined in server.xml did not show up.
:: >
:: > Has anyone gotten this feature to work? Am I missing something? Here
:: > are a few code snippets:
:: >
:: > server.xml in the <Context> tag for my webapp
:: > <Parameter name="companyName" value="MyCompany" override="false"/>
:: >
:: > from my servlet
:: > ServletConfig config = getServletConfig();
:: > String name = getInitParameter("companyName");
:: > System.err.println("CompanyName = '" + name + "'");
:: >
:: > Enumeration enum = config.getInitParameterNames();
:: > while(enum.hasMoreElements())
:: > {
:: >    System.err.println(enum.nextElement());
:: > }
:: >
:: >
:: > Thanks-
:: > Michael
:: >
:: >
:: > ---------------------------------------------------------------------
:: > To unsubscribe, e-mail: [EMAIL PROTECTED]
:: > For additional commands, e-mail: [EMAIL PROTECTED]
:: >
:: 
:: 
:: 
:: ---------------------------------------------------------------------
:: To unsubscribe, e-mail: [EMAIL PROTECTED]
:: For additional commands, e-mail: [EMAIL PROTECTED]



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

Reply via email to