Re: Changing a property in the context
Kenney Westerhof <[email protected]>
| Newsgroups | gmane.comp.jakarta.cactus.user |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 23 Jan 2006, Javier Gutierrez wrote:
Hi,
> Hello.
>
> I am trying to change a context property for the unit
> test of a Servel. First, I wrote next code:
Servel = servlet?
> ServletContextWrapper context = (ServletContextWrapper
^^^^^^^
> ) config.getServletContext();
> context.setInitParameter ("dataconexion",
> "tralalala");
>
> However, when initiating my Servlet with:
>
> myServlet.init (config);
^^^^^^
context != config.. what is config? dit you set the parameter there?
> The property was unchanged. Looking at the code of
> AbstractServletConfigWrapper I have found that it
> return a new copy of the context when calling
> getServletContext(), so my change is not stored in the
> configuration.
That might be, but that's not what's causing this.
> is there any way to change a property of the context ?
Yup, you did it right.
However, you are probably reading the value from the ServletCONFIG object,
not the ServletCONTEXT object, and you didn't set it there..
Hope this helps!
-- Kenney
> How can I do it?
>
> Thank you very much.
>
>
>
>
> ______________________________________________
> LLama Gratis a cualquier PC del Mundo.
> Llamadas a fijos y móviles desde 1 céntimo por minuto.
> http://es.voice.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key