**** 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).
<%! private class Test { String name = null; public Test(String n) { this.name = n; } String getName() { return this.name; } } static Test test = new Test("foobar"); %> <%= test.getName() %> **** With Tomcat, I am getting the following error: org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 15 in the jsp file: /test.jsp No enclosing instance of type test_jsp is accessible. Must qualify the allocation with an enclosing instance of type test_jsp (e.g. x.new A() where x is an instance of test_jsp). 12: } 13: } 14: 15: static Test test = new Test("foobar"); 16: %> 17: 18: <%= test.getName() %> **** Changing the code as following worked: static Test test = new test_jsp().new Test("foobar"); **** My questions: I suppose this is a change from jdk 1.4 to 1.5? Doesn't this make the JSP page container dependent? I think that the naming convention of a JSP page's class is implementation specific. Having an inner class in a JSP page sometimes is pretty convenient for organizing some light data used in the page, such as menu text. Is there another alternative other than having a regular class? Any input would be appreciated. Thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org