The Eclipse JSP editor cannot parse the Java block comment in seperate scriptlets like
<% /* %><span> blabla </span><% */ %>
Here's what it looks like in Eclipse:
In practice, we know the code between /* */
will be commented out, but eclipse editor shows code between as normal text. That is totally confusing.
I know this case should be avoided, but I got a huge amount of such code to read.
So is there any method to enable syntax highlighting for this case?
Test case:
<TABLE>
<TR><TD>Normal text</TD></TR>
<% /* %><TR><TD>Unparsed comment</TD></TR><% */ %>
<% /* <TR><TD>Parsed comment</TD></TR> */ %>
<%-- <TR><TD>Parsed comment</TD></TR> --%>
</TABLE>
That's a great way to write unmaintainable code. While you have a point that it might be technically a bug in the workings of the editor, I'd not rely on it to reliably work: A JSP is compiled into a servlet (turned inside out), then compiled to bytecode.
<%-- --%>
- to be intentionally evil and this style wouldn't pass (my) code review.Take this behaviour as a hint that you should consider rewriting your code in a different way and don't rely on the JSP->Servlet compiler to always follow your current mental model. It might as well break with a future compiler-update in a year - and then you'd have to remember what you did here, why you did it. And you wouldn't have a clue why it worked all the time and suddenly stopped. You'll probably not attribute it to an update to the servlet container that someone did behind your back.