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 --%>
<!-- 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.
<!-- 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.
Comments are closed for "JSP Comments".
Hi. your site is good.
I have a question. Which is better to use.
JSP Comment
HTML Comment
JAVA Comment
@Senthilkumar,
JSP 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
it will depends on ur requirement
Jsp comment is best to use
can i know how many types of jsp comments
joe, thanks… you are excellent buddy…
can you please tell me the jsp or html codes for posting comments in a website?
I think it is better to use jsp comment in comparison to others ..
Aishwarya Prakash Pandey
“ is not a JSP comment.”
This is not true. It is a JSP “HTML Comment” and can contain an expression that is evaluated when the page is loaded.
referred to here as a JSP Comment is actually a JSP “Hidden Comment” and is NOT sent to the browser.
“ is not a JSP comment.”
This is not true. It is a JSP “HTML Comment” and can contain an expression that is evaluated when the page is loaded.
referred to here as a JSP Comment is actually a JSP “Hidden Comment” and is NOT sent to the browser.
in this u said that it can be seen in view seen… Can u pls Explain it….
for html comment u said that it can be seen in view code… Can u pls Explain it….
Excellent Man…. I have 7+ IT exp… I was not aware of such thing.
hello sir i want to know how to send sms through jsp code to a mobile.Plese help me.
Waiting for your response.
Thank you
“Therefore, there is nothing called as hidden comment or output comment in JSP by specification.” —– I’ve really liked it. Its a very good observation.
Hi Joe,
This post can be made more funny (nay confusing for the beginners) if it includes:
1. CSS comments: CSS may be a part of JSP file
/* It is a CSS comment*/
2. Javascript comments: Javascript may be a part of JSP file
// Single line comment
/* multiline
comment */
3.
4. Hide script from old browsers:
And so on. If HTML comment is considered as another type of JSP comment then why not the above types?
Thanks,
Amitabha
its depend upon your use…if you want to see the commented portion in your html source then you can use html comments else if you want to comment something inside your jsp code then only you can give jsp comment.
clearly explained :) thumbs upp!!
can anyone tell me , what is the syntax for error message