tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Baringer <marco.barin...@convey.it>
Subject Re: wrapper.bin.parameters
Date Fri, 11 May 2001 09:57:05 GMT
try this (in web.xml)

<context-param>
  <param-name>SecretAgent</param-name>
  <param-value>007</param-value>
</context-param>

And then from a servlet (or JSP):

String agent = getServletContext().getInitParameter("SecretAgent");

and the following will be true:
(agent == "007")

For more info the API docs are always the best place
(javax.servlet.Servlet, javax.servlet.ServletConfig,
javax.servlet.ServletContext)

Getting a ServletContext is always direct as the interface
javax.servlet.Servlet does not provide a getServletContext method so
you'd have to do
Servlet.getServletConfig().getServletContext(), however the class
GenericServlet does provide a getServletContext() method (which is
just sugar)

how this helps
-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There's a crack in everything.
It's how the light gets in.
	-Isonard Cohen

Mime
View raw message