JSP.2.3 Comments


There are two types of comments in a JSP page: comments to the JSP page itself, documenting what the page is doing; and comments that are intended to appear in the generated document sent to the client.

JSP.2.3.1 Generating Comments in Output to Client

In order to generate comments that appear in the response output stream to the requesting client, the HTML and XML comment syntax is used, as follows :

 <!--  comments  ... --> 

These comments are treated as uninterpreted template text by the JSP container. If the generated comment is to have dynamic data, this can be obtained through an expression syntax, as in:

 <!--  comments  <%= expression %>  more comments  ... --> 

JSP.2.3.2 JSP Comments

A JSP comment is of the form

 <%-- anything but a closing --%> ... --%> 

The body of the content is ignored completely. Comments are useful for documentation but also to "comment out" some portions of a JSP page. Note that JSP comments do not nest.

Note that an alternative way to place a "comment" in JSP is to do so by using the comment mechanism of the scripting language. For example:

 <% /**  this is a comment  ... **/ %> 


Java 2 Platform, Enterprise Edition. Platform and Component Specifications
Java 2 Platform, Enterprise Edition: Platform and Component Specifications
ISBN: 0201704560
EAN: 2147483647
Year: 2000
Pages: 399

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net