12:50 pm - Saturday July 22, 2017

Comments in JSP

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

Java comment cannot be used in jsp file, if we need any comment inside the jsp file to describe the code we can use jsp comment. Jsp comment cannot be used by client side.

Syntax:

<% -- jsp comment -- %>

 

JSP Files:

 

 

 

 

 

CommentExample.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Comment</title>
</head>
<body bgcolor="pink">
<font color="Purple" size=5>
<h2 align="center">**This Program is to Explain the comment
Scripting Element in JSP.**</h2>
<%
	out.println("This program Explains theComment Scripting Element ");
%> <%-- This is the Comment Scripting elmentin jsp--%> </font>
</body>
</html>

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
	xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>CommentExample</display-name>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>
</web-app>

OUTPUT:

DOWNLOAD+SOURCECODE

Filed in: Z-AJSP Codes

No comments yet.

Leave a Reply