How to add Comments in JSP

Comment: A comment marks text or lines that the JSP container should ignore. A comment is useful when you want to comment out part of your JSP page. The JSP container does not process anything within the <%– and –%> characters or within the <!– and –> characters. A comment is not inserted into the response.

JSP Syntax-

 

<%– comment –%>

XML Syntax-

 

<!– comment –>

Example-comment.jsp

 

 

<%@ page language=”java” %>

<html>

<head><title>A Comment Test</title></head>

<body>

<h2>A Test of Comments</h2>

<%– This comment will not be included in the response –%>

</body>

</html>

Leave a Reply

Your email address will not be published. Required fields are marked *