Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
Comments in Jsp 
 

In a jsp we should always try to use jsp- style comments unless you want the comments to appear in the HTML.

 

Comments in Jsp

                          

In a jsp we should always try to use jsp- style comments unless you want the comments to appear in the HTML. Jsp comments are converted by the jsp engine into java comments in the source code of the servlet that implements the Jsp page. The jsp comment don't appear in the output produced by the jsp page when it runs. Jsp comments do not increase the size of the file,  jsp page are useful to increase the readability of the jsp page.

In Jsp two types of comments are allowed in the Jsp page:

1) Hidden comment: This comment will not appear in the output.

<%-- Hidden comment --%>

2) Output comment: This type of comment will appear in the output.

<!-- Output comment>

If we have to pass the comment inside the directive then there we use a single line comment i.e. //

Code of the program is given below:

<HEAD>
    <TITLE> </TITLE>
  </HEAD>
  <BODY>
  <font  size="6" color ="#000080">JSP Comments</font><br> 
	
	<% 
 // System.out.println
      ("This is Single line comment inside scriptlet tags");
       /*
 System.out.println
      ("This is multiline comment inside scriptlet tags");
 System.out.println
      ("This is multiline comment inside scriptlet tags");
 System.out.println
      ("This is multiline comment inside scriptlet tags");
            
	   */
	%> 
	<%-- 
	    <%	    
		if (Math.random() > .5) {
            out.println("<b>You win!</b>");
        } else {
            out.println("Sorry, you lose. Try again.");
        } 
		%>
		<%=userName %>
		
	--%>
	<!--
         this is HTML tag
	-->
	<table>
		<tr>
			<td>
      <b>Single line comment inside scriptlet tags:</b> </br>
			
	   // System.out.println("Roseindia.net");</br>
      <b> Multiline comment inside scriptlet tags:</b></br>
       /*</br>
		   System.out.println("Roseindia.net");</br>
		   System.out.println("Roseindia.net");</br>
		   System.out.println("Roseindia.net");</br>
            
	   */</br>
	  <b>JSP Comment:</b> </br>
			
&lt;&#37;&#45;&#45; <br>

&nbsp;&nbsp; &lt;&#37;<br>

  &nbsp;&nbsp;&nbsp;&nbsp;System.out.println
            ("Roseindia.net");<br>

&nbsp;&nbsp; &lt;&#37;<br>
		
         &lt;&#37;&#45;&#45;
			</td>
		</tr>
		<tr>
		<td></td>
		</tr>
		</table>
  </BODY>
</HTML>

Download this example.


 

                          

» View all related tutorials
Related Tags: c string arrays ide array session url list data variables properties application object lists curl io map types scope property

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

2 comments so far (
post your own) View All Comments Latest 10 Comments:

I have your site for its useful and funny content and simple design.

Posted by Rosina on Tuesday, 07.29.08 @ 02:02am | #69642

made it .All information on this site is represented for users. A site is

Posted by Albert on Thursday, 05.22.08 @ 18:24pm | #60663

Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.