tomcat-users mailing list archives

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

>1) do I need a seperate <context-param> tag for each context parameter,
or
>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
the
>init() method? Or on the fly, for example at the start of the doGet()
>method?

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:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message