tags:

views:

223

answers:

3

How to comment the code in jspx page? I have tried several methods,

<!--  -->
<%-- -->

but it doesn't not work!

So I have to:

<c:if test="${false}">code</c:if>,

it is really urgly, Is there any other ways? Any help is appreciated!

+2  A: 

You were close with one of your attempts, JSP comments look like below:

<%-- some commented out stuff --%>
Tendayi Mawushe
Thanks,Tendayi. Actually, I have try <%-- some commented --%>,and I always get the exception under tomcat6.0 as below,org.apache.jasper.JasperException: /WEB-INF/views/login.jspx(12,10) The content of elements must consist of well-formed character data or markup.
ricky
A: 

Have you tried XML IGNORE?

<![IGNORE[
  <!-- commented out XML -->
]]>

Change INGORE to INCLUDE when you want it back.

ZZ Coder
A: 

I have never used JSPX, so don't pin me on it, but try

<%-- <![CDATA[ some comment ]]> --%>

or the other way round

<![CDATA[ <%-- some comment --%> ]]>
BalusC
BalusC, Thanks! but both ways don't work under tomcat6.0. I just got the exception: The content of elements must consist of well-formed character data or markup. It is wierd.
ricky