2 Minutes To Code (β Version)

JSP - 2 minute tutorial

Jsp Comemnts

Comments can be written in a jsp page in 2 ways.

1. jsp syntax comments

These comments which are written using <%-- &--%> are parsed by the jsp engine ( i.e. webserver) itself and ignored at the server itself.

That is, if you view the source code of a webpage in the browser (using the 'right click -> view source' option), then these comments will not be present unlike the second type of comments mentioned below.
<html>
	<body>
		Hi friends ! 
		<%--  No armageddon in 2012 --%>
	</body>
</html>

2. html syntax comments

These comments which are written using <!-- &--> are parsed and processed by the jsp engine and also sent by the webserver as a part of the webpage.

If you view the source code of a webpage in the browser, these comments will not be present.

So, you can use it to troubleshoot your code, as any jsp expression or jsp scriptlet inside these comments will be executed by the webserver and output generated will end up in the webpage source code, although web browser will not display it as it an html comment.
<html>
	<body>
		Hi friends ! 
			<!--  No armageddon in 2012 -->
			<!--  The current date is <%= new java.util.Date() %> -->
	</body>
</html>