When I try the version with the toString() method, the result is the same. Note: I obtained the source by deploying a .war file I downloaded. The application byte code which maps to the source runs fine in Tomcat5.5. This would seem to indicate that the problem lies with my IDE (IntelliJ Idea) or with an incompatibility with servlets.jar. But all documentation which I have seen indicates that getAttribute(String) is a method in HttpSession.
Thanks for the suggestion. I was in the process of narrowing this down. I had downloaded and installed Sun's Enterprise IDE and experienced no problems compiling in that environment. I also noticed that in Sun's environment there was no servlets.jar file, everything needed for app server packaged together in j2ee.jar. So I added j2ee.jar to my IntelliJ Idea project classpath and problem solved! Thanks to all who have helped me with this problem.
I carry this gun in case a vending machine doesn't give me my fritos. This gun and this tiny ad:
a bit of art, as a gift, that will fit in a stocking