- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to write a comment in a JSP page?
JSP comment marks to text or statements that the JSP container should ignore. A JSP comment is useful when you want to hide or "comment out", a part of your JSP page.
Following is the syntax of the JSP comments −
<%-- This is JSP comment --%>
Following example shows the JSP Comments −
<html> <head> <title>A Comment Test</title> </head> <body> <h2>A Test of Comments</h2> <%-- This comment will not be visible in the page source --%> </body> </html>
The above code will generate the 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 −
|S.No.||Syntax & Purpose|
|1||<%-- comment --%>|
A JSP comment. Ignored by the JSP engine.
|2||<!-- 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.
- How to write a for loop in a JSP page?
- How to write a while loop in a JSP page?
- How to write a switch statement in a JSP page?
- How to write an if-else statement in a JSP page?
- How to create a common error page using JSP?
- How to refresh a JSP page at regular interval?
- How to write a JSP Expression?
- How to send a html based email using a JSP page?
- How to send a email with attachment using a JSP page?
- How to print current date and time in a JSP page?
- What is a page object in JSP?
- What is a page directive in JSP?
- How a JSP page works. Can somebody explains the JSP architecture in simpler terms
- How to send a simple text based email using a JSP page?
- How to avoid Java code in jsp page?