There is only one type of JSP comment available by JSP specification.
JSP Comment Syntax:
<%-- comment --%>
This JSP comment tag tells the JSP container to ignore the comment part from compilation. That is, the commented part of source code is not considered for the content parsed for ‘response’.
Example:
<%-- This JSP comment part will not be included in the response object --%>
Is this a JSP Comment?
<!-- comment --> is not a JSP comment. This is HTML comment. The JSP container treats this HTML comment tag as equal as any other HTML tags. When view source is done, the content given between this tag is visible. This is not anyway related to the JSP container, it is the expected behaviour of this HTML tag.
Example
<!-- This HTML comment part is included in the response object and can be seen in view source -->
// or /* comment */ used inside the <% %> scriplet tag is also not a JSP comment. This is just a java comment and JSP container doesn’t reserve any special treatment for this comments usage.
Therefore, there is nothing called as hidden comment or output comment in JSP by specification.














Hi. your site is good.
I have a question. Which is better to use.
JSP Comment
SenthilKumar on December 27th, 2009 2:23 amHTML Comment
JAVA Comment
Hi
Its better to use JSP comment
jhhhhh on June 25th, 2010 11:04 am@Senthilkumar,
Joe on January 21st, 2011 2:12 amJSP Comments or Java Comments or HTML Comments? It depends on the part of code you want to comment, since JSP comments can be used to comment out, HTML or scriplets also.
hai,this is useful for easily understanding the jsp
ilanthamilan on March 28th, 2011 12:36 pmit will depends on ur requirement
chinna on April 15th, 2011 2:20 amJsp comment is best to use
can i know how many types of jsp comments
dev on April 3rd, 2012 12:51 pmjoe, thanks… you are excellent buddy…
tuhin on April 14th, 2012 12:13 pmcan you please tell me the jsp or html codes for posting comments in a website?
sukanya nath on April 21st, 2012 6:07 pmfdss
sukanya nath on April 21st, 2012 6:11 pm