Return-Path: Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 28162 invoked from network); 14 Jul 2000 23:21:13 -0000 Received: from mercury.sun.com (192.9.25.1) by locus.apache.org with SMTP; 14 Jul 2000 23:21:13 -0000 Received: from eastmail2.East.Sun.COM ([129.148.1.241]) by mercury.Sun.COM (8.9.3+Sun/8.9.3) with ESMTP id QAA00705 for ; Fri, 14 Jul 2000 16:21:12 -0700 (PDT) Received: from swanaba.east (swanaba.East.Sun.COM [129.148.162.54]) by eastmail2.East.Sun.COM (8.9.3+Sun/8.9.3/ENSMAIL,v1.7) with ESMTP id TAA11881 for ; Fri, 14 Jul 2000 19:21:12 -0400 (EDT) Received: from eng.sun.com (swantty.East.Sun.COM [129.148.162.52]) by swanaba.east (8.8.8+Sun/8.8.8) with ESMTP id TAA17283 for ; Fri, 14 Jul 2000 19:20:22 -0400 (EDT) Message-ID: <396FA07F.D89FE168@eng.sun.com> Date: Fri, 14 Jul 2000 16:21:36 -0700 From: "Craig R. McClanahan" X-Mailer: Mozilla 4.72 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: tomcat-user@jakarta.apache.org Subject: Re: ServletContext.setAttribute() References: <4.1.20000714113502.00a12ef0@clipshow.com> <4.1.20000714161810.00a0f4d0@clipshow.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit A common way for this to happen is for you to have old servlet classes on your compile CLASSPATH -- such as the "jsdk.jar" file that contains version 2.0 classes (before the ServletContext.setAttribute() method was added to the API). Craig McClanahan Mason Jones wrote: > Very strange... I got the same message from the compiler > about not finding a matching method. Must be something > weird with my JDK, but I'm not sure how that could be. > > At 04:04 PM 7/14/00 -0700, you wrote: > >This worked for me... I did something like: > > > >ServletConfig sc=getServletConfig(); > >ServletContext ctx=sc.getServletContext(); > >ctx.setAttribute("formMessage",msg); > > > >(from within a class that extended HttpServlet) > > > >On Fri, 14 Jul 2000, Mason Jones wrote: > > > >> > >> I'm trying to compile a servlet to test setting an attribute in the > >> servlet context, and getting an odd error: > >> > >> formEditClip.java:31: Method setAttribute(java.lang.String, > >> java.lang.Object) no > >> t found in interface javax.servlet.ServletContext. > >> context.setAttribute("formMessage", msg); > >> > >> Looking in the javadoc API for ServletContext, that is certainly > >> the correct form of the method call... And as far as I know I have > >> the latest JSDK, and it's finding the class. Are the javadocs > >> wrong? Is there another version of the method call that anyone > >> out there knows about? > >> > >> Thanks for any help. > >> > >> > >> > >> ________________________________________ > >> Mason Jones mason(at)clipshow.com > >> Director of Software Development > >> ClipShow, Inc. www.clipshow.com > >> (650) 696-3164 fax (650) 696-3267 > >> > >> > >> > > > >-Eric Harashevsky > > ________________________________________ > Mason Jones mason(at)clipshow.com > Director of Software Development > ClipShow, Inc. www.clipshow.com > (650) 696-3164 fax (650) 696-3267