Thanks for pointing this out. This article makes it very clear: http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html
Qiao -----Original Message----- From: Konstantin Kolinko [mailto:knst.koli...@gmail.com] Sent: Saturday, January 24, 2009 12:55 PM To: Tomcat Users List Subject: Re: Inner class trouble in JSP 2009/1/24 Qiao Jin <bra...@gmail.com>: > **** I am using Tomcat 6.0.18 with JDK 1.5.0_17 on CentOS 5. I am getting a > compiling error on the following code in a jsp page that uses an inner > class. I remember I used to be able to do this with a different container > (implementing JSP 1.2 and JDK 1.4). > It has nothing to do with specific container. It is a plain Java issue: you should learn the difference between "inner" classes and "static inner" classes. Look somewhere for details. Here, replace this line > private class Test { with private static class Test { and you will be fine. An alternative solution would be to replace static field with an instance one, > static Test test = new Test("foobar"); Test test = new Test("foobar"); but that depends on what your intentions are. Note, that because JSP page is a servlet, the same instance will be reused for all requests, so there is no much difference between static and instance field here. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org