JSP syntax

Published: Thursday, 3 November 2005

Comments

Block comments start with <%-- and end with --%>

If you use HTML style comments, or JavaScript comments, the JSP engine will still evaluate the commented portions of your code. In general we use JSP style comments where possible because:

  • It cuts down on the total size of the generated HTML file. The comments will still be viewable using ViewSource from your browser if you use HTML style comments.
  • Exposure of inadvertent comments in reduced.
  • It reduces load on the server as the portion of commented code is not evaluated.