A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

What is JSP Comments?

JSP Comments:

JSP comment marks text or statements that the JSP container should ignore. A JSP comment is useful when you want to hide or "comment out" part of your JSP page.

Following is the syntax of JSP comments:<%-- This is JSP comment --%>

Following is the simple example for JSP Comments:<html>
<head><title>A Comment Test</title></head>
<h2>A Test of Comments</h2>
<%-- This comment will not be visible in the page source --%>

This would generate following result:

A Test of Comments

There are a small number of special constructs you can use in various cases to insert comments or characters that would otherwise be treated specially. Here's a summary:

<%-- comment --%>
A JSP comment. Ignored by the JSP engine.
<!-- comment -->
An HTML comment. Ignored by the browser.
Represents static <% literal.
Represents static %> literal.
A single quote in an attribute that uses single quotes.
A double quote in an attribute that uses double quotes.