JSP Comments
Comments can be added in three ways to JSPs. The syntax for JSP comments is <%-- --%>.
<%-- This is a JSP comment --%>
HTML comments can still be used. HTML comment syntax uses <!-- -- >. You can insert Java Style
comments into your scripting elements as well, although this is uncommon.
<html>
<body>
<%
//this is a Java comment in a scriptlet
for (int i =0; i < 10; i++) {
%>
<h1>Hello, JSP World</h1>
<%
}
%>
</body>
</html>
While HTML comments get sent to the client, JSP comments are removed by the JSP compiler and therefore
not added to the HTML response. Therefore, the JSP comments have benefits over HTML comments. JSP
comments are not seen by the clients!
Further, HTML comments make the response message larger. JSP comments do not make the response
message larger.
JSP Comments
Table of Contents
Copyright (c) 2008. Intertech, Inc. All Rights Reserved. This information is to be used exclusively as an
online learning aid. Any attempts to copy, reproduce, or use for training is strictly prohibited
Services
Training Resources
Tutorials
Courseware