• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compiler error on new type of for loop in 1.5

 
bryan nelson
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

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?

Any leads would be greatly appreciated!

Thanks,
bryan
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure your app container is using 1.5?
 
bryan nelson
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep. I'm using Tomcat 5.5.9.

And here's the JVM path that it's pointing to:

C:\Java\jre1.5.0_04\bin\client\jvm.dll


I'm confused. Is there some other setting in Tomcat that I could check?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the Tomcat forum.
 
bryan nelson
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been moved! Nice!

So does anyone in here have any ideas?

Thanks so much!
b
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

http://eclipse.sys-con.com/read/46259.htm?CFID=81489&CFTOKEN=E94B9749-1022-6501-84AB13AC36D334D1
 
bryan nelson
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alright everyone...check it out:

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!

Hope this helps someone!

b
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice job Bryan,
Thanks for posting back with the work around.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic