I've come across an error on a jsp page that is using the new type of for loop from JDK 1.5.
Here's the code:
<% for (Operation op : Operation.values() ) %>
and here's the error: [ServletException in:/web/jsp/admin/role/roleModify.jsp] Unable to compile class for JSP An error occurred at line: 102 in the jsp file: /web/jsp/admin/role/roleModify.jsp Generated servlet error: Syntax error on token ":", ; expected An error occurred at line: 102 in the jsp
I have this same type of loop working in actual .java file; why won't it work here?
Do I have to import something into the .jsp so that I can use the new 1.5 syntax?
Originally posted by bryan nelson: I've been moved! Nice!
That's a good thing. You're in the right forum now.
One thing that I do know is that, starting with 5.5x, Tomcat ships with it's own compiler (JTD: the one from the folks at Eclipse). Not sure how much help that is but it might get you pointed in the right direction or open up some other other avenues to explore.
Ben was indeed on the right track with his last post. Apparently (and feel free to correct me if any of this is wrong) Tomcat 5.5.9 comes with the jasper-compiler-jdt.jar...and apparently it doesn't parse any scriptlets written in 1.5 (yet, although it may in the future??). So the fix is to swap that file out with the newest ant.jar file. That's the first step.
The next step is making sure that tomcat is setup to actually recognize the 1.5 scriptlets. In your CATALINA\conf\web.xml file you need to add two entries:
that will make tomcat compile with 1.5 instead of 1.4...1.4 is the default according to the docs on the Tomcat 5.5.x Jasper Page.
And there it is. At least, that worked for us here. Of course another alternative is just to not use any scriptlets in your jsp anyway (which I personally think is better), but you do what you gotta do!