jsp Comments in JSP JSP Comments Example


Example

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<title>JSP Comments</title>
</head>
<body>
    <%-- JSP comments --%> -- Ignored by container, you can't see this comment in source code of JSP_java class translated by container, doesn't include in response

    <!-- HTML comments --> -- Ignored by browser, You can see this comment in source code of html page but browser ignores it to print on page, included in response

    <% // java comments %> -- Ignored by JRE, This comment can be seen in JSP_java class translated by container, doesn't include in response
    
    <!-- Today is <%= new java.util.Date() %> -->
    
</body>
</html>

When you run above code, output will be a blank page. To understand difference between these comments you need to see the source of web page and source code of JSP_Java class translated by container.