JSP comment
Used for commenting JSP tags base code (or JSP code) of JSP program. A JSP page compiler recognizes JSP comments. As JSP comments are visible in source, code of JSP program and not visible in any other process of JSP program execution so these are called hidden comments. They are written like this:
<%–……..–>
HTML Comments
Used for commenting html code and text of JSP program. Html interceptor recognizes this type of comments. We use html comment on scripting JSP tags (scriptlet, declaration and expression) but we cannot use these comments on other JSP tags. They are written like this:
<!– ……………..–>Script comments
Java compiler recognizes this type of comments.
//:-used for commenting one line of code
/*….* /: -used for commenting multiple line of code
Visibility Chart of JSP Comments
Comments | In JSP program | Compiled of java equivalent Servlet | Html code that comes to browser | Output | |
JSP comments | Yes | – | – | – | – |
Html | Yes | Yes | Yes | Yes | – |
Java comments | Yes | Yes | – | – | – |