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]



Reply via email to