Sunday, August 2, 2009

JSP interview Questions

What is a output comment?

  A comment that is sent to the client in the viewable page source.The JSP engine handles an output comment as uninterpreted HTML text, returning the comment in the HTML output sent to the client. You can see the comment by viewing the page source from your Web browser.

JSP Syntax

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

Example 1

<!-- This is a commnet sent to client on

<%= (new java.util.Date()).toLocaleString() %>

-->

Displays in the page source:

<!-- This is a commnet sent to client on January 24, 2004 -->        

What is a Hidden Comment?

                A comments that documents the JSP page but is not sent to the client. The JSP engine ignores a hidden comment, and does not process any code within hidden comment tags. A hidden comment is not sent to the client, either in the displayed JSP page or the HTML page source. The hidden comment is useful when you want to hide or "comment out" part of your JSP page.

You can use any characters in the body of the comment except the closing --%> combination. If you need to use --%> in your comment, you can escape it by typing --%\>.

JSP Syntax

<%-- comment --%>

Examples

<%@ page language="java" %>

<html>

<head><title>A Hidden Comment </title></head>

<body>

<%-- This comment will not be visible to the colent in the page source --%>

</body></html>

 

 

1

2

3

4

5

6

7

8

9

10

 

No comments:

Post a Comment