Comments are used to document your code.You can use comments to explain code that is difficult to understand as well as the inner workings of any algorithms that are used.Comments provide an important communication tool between you and the programmer who will update and maintain the code at a later date.
- <html>
- <head>
- <title> Simple JSP page </title>
- </head>
- <body>
- <h3>Including Comments in your code</h3>
- <p>
- <!-- An HTML Comment -->
- <%--A JSP Comment --%>
- <%
- // A Single line comment
- for(int i=1;i<7;i++)
- {
- /* A multi line comments
- spans many lines */
- out.println("No of times this code has been repeated:"+i);
- out.println("<br>");
- }
- %>
- </body>
- </html>
Description:
- An HTML comment is enclosed within the <!-- and --> delimiters.HTML comments aren't displayed in a Web page, but they are included in the generated HTML source code.This can easily be accessed by anyone who views the source code in a Web browser.You should not place any sensitive information in HTML comments.
<!-- An HTML Comment -->
- JSP comments are enclosed within the <%-- and --%> delimiters. JSP comments are not sent to the Web browser.
<%--A JSP Comment --%>
- The // delimiter can be used to create a single comment line in a Scriplet tag.
- A multi-line comment can be placed within the /* and */ delimiters.
/* A multi line comments
spans many lines */
spans many lines */
************************************OUTPUT***********************************
Including Comments in your code
No of times this code has been repeated:1
No of times this code has been repeated:2
No of times this code has been repeated:3
No of times this code has been repeated:4
No of times this code has been repeated:5
No of times this code has been repeated:6
*******************************************************************************No of times this code has been repeated:2
No of times this code has been repeated:3
No of times this code has been repeated:4
No of times this code has been repeated:5
No of times this code has been repeated:6
No comments:
Post a Comment