Free WebSchools.com

Google


Submit ArticleForumsLive chat Webhosting Link TO Us SEO Toolsjobs & interview


HOME

Java Server Pages

JSP Introduction
JSP Syntax
JSP Expression
JSP Declaration
JSP Comments

JSP Directives
JSP Actions
JavaBeans
JSP Sessions
JSP JDBC
JSP And HTML Forms
JSP With XML

JSP Exam


JSP comments







An HTML comments in a JSP file is very similar to nay other HTML comment. It documents the file and can be viewed in the page source form the web browser. The HTML comments in a JSP file is different from HTML comment in the sense that the comment in JSP file may contain an expression, the expression is dynamic and is evaluated when the page is loaded or reloaded in the web browser. You can use any expression that is valid in the page scripting language. The syntax for writing a comment is as follows

<! – comment [<%= expression %>] -->?



For example <! – this a simple comment in a JSP file -->

This would display on the screen

<! – this is a simple comment in a JSP file -->

JSP comments may also contain expression. The following example uses an expression to display the current data on the source page

<!—this page was loaded on <%=(new java.util.Data()).toLocalString()%--->

This could display the following on the screen

<!—this page was loaded on July 26,2006 -->

hidden Comments

a hidden comment documents the JSP page but is not sent to the client. A hidden comment marks text or lines, which are ignored by the JSP container. A hidden comment is useful when you want to hide or “comment out” part of your JSP page. The syntax for writing a hidden comment is as follows

<%-- comment --%> Anything between the >%-- and --%> is ignored by the JSP container. A hidden comment is not sent to the client, either in the displayed JSP page or page source.

you can use any character in the body of the documents except the closing --%> combination. If ypou need to use --%> in your commeny, you can escape it by typing --%>. For example <-- this line will not be visible on the page source --%>

Inform Friend About This Site

Your Name:

Friend's Name:

Friend's Email: