tags:

views:

543

answers:

3

How can I comment a JSP expression like: <%= map.size() %>

Is there something like <%= // map.size() %>?

A: 

One of:

In html <!-- map.size here because --> <%= map.size() %>

theoretically the following should work, but i never used it this way.

<%= map.size() // map.size here because %>

jim
+5  A: 

Pure JSP comments look like this:

<%-- Comment --%>

So if you want to retain the "=".you could do something like:

<%--= map.size() --%>

The key thing is that <%= defines the beginning of an expression, in which you can't leave the body empty, but you could do something like this instead if the pure JSP comment doesn't appeal to you:

<% /*= map.size()*/ %>

Code Conventions for the JavaServer Pages Technology Version 1.x Language has details about the different commenting options available to you (but has a complete lack of link targets, so I can't link you directly to the relevant section - boo!)

insin
A: 

your <%= //map.size() %> doesnt simply work because it should have been

<% //= map.size() %>
lock