You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alex Colic <al...@pop-ware.com> on 2001/04/19 19:33:11 UTC

Is this a bug in tomcat or me?

Hi,

I am having major problems with the servletContext.

In my main class I do the following:

  ServletContext context=getServletContext();
  context.setAttribute("Key", Boolean.TRUE);

Then in one of my jsp tags if want to check the value of "Key" I do the
following:

Boolean active =
(Boolean)pageContext.getServletContext().getAttribute("Key");

If I want to change the value of "Key" I do the following:

      Boolean active=(Boolean)context.getAttribute("Key");
      active=Boolean.TRUE or FALSE;
      context.setAttribute("Key",active);

I have also tried:

context.setAttribute("Key",Boolean.FALSE);

My problem is no matter what value I set, when I pull active out the value
of "Key" out of the context it is always TRUE.

Any ideas what I am doing wrong?

Any help is appreciated

Regards

Alex