tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: <context-param>
Date Wed, 15 Jan 2003 15:23:00 GMT

>1) do I need a seperate <context-param> tag for each context parameter,
>can I put them all in the same block?

Separate <context-param> for each parameter.  They're just like
init-params in that way.  See the servlet specification's explanation of
the web.xml fields for more details.

>2) where is the best place to call
>"getServletContext().getInitParameter("driver")" within a servlet? In
>init() method? Or on the fly, for example at the start of the doGet()

Doesn't really matter.  It's always going to be available.  As their
name suggests, they're typically used during initialization to set up
things like database connections (and pools), JNDI entities, etc.  But
the servlet container is required to make the ServletContext available
to its servlets as long as the context is running.  So you can use it
anywhere: init, service methods, destroy...

Yoav Shapira
Millennium ChemInformatics

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message