You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Viktors Krebss <lo...@delfi.lv> on 2001/08/02 18:07:15 UTC

ServletContext access

Hello,

Does anyone know how can I access servlet init parameters form another
servlet ?
I mean I can access servlet context (<context-param> ) using
getServletContext().getContext("/someservlet")
but what I need is to get into <servlet>
...<init-param>param-I-need-to-know</ .
Is it possible at all ?
Thanks for you help.

Regards,
--

Viktors Krebss, lopik@delfi.lv
SMC , http://www.smc.lv/
tel: +371-7777748, mob: +371-9243923, fax: +371-7777701

Re: ServletContext access

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 2 Aug 2001, Viktors Krebss wrote:

> Hello,
> 
> Does anyone know how can I access servlet init parameters form another
> servlet ?
> I mean I can access servlet context (<context-param> ) using
> getServletContext().getContext("/someservlet")
> but what I need is to get into <servlet>
> ...<init-param>param-I-need-to-know</ .
> Is it possible at all ?
> Thanks for you help.
> 

There's nothing in the servlet API that lets you access this.

Of course, you could parse the /WEB-INF/web.xml file yourself, but it
seems much easier (to me, at least) to make the shared parameter a context
init param instead.

> Viktors Krebss, lopik@delfi.lv

Craig