JSP page Directive

JSP page Directive


Posted in : Java Posted on : January 24, 2012 at 6:39 PM Comments : [ 0 ]

In this tutorial you will learn how to use the page directive in JSP.

JSP page Directive

In this tutorial you will learn how to use the page directive in JSP.

page directive element in JSP specifies the page-dependency properties and their communication to the JSP container. This directive have the various optional attributes that are used to provide information to the JSP container. There can more than one attribute be contained by this element but instance of these attributes will be only one except that the 'import' and 'pageEncoding' attributes.

Syntax :

<%@ page attribute ... %>

Here attribute can be language, extends, import, buffer, pageEncoding, errorPage, contentType, session, autoFlush, isThreadSafe, info, isELIgnored, isScriptingEnabled.

Example :

page.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.Date" %>
<!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>Jsp page Directive Example</title>
</head>
<body>
<%
Date date = new Date();
%>
<table>
<tr>
<td>Current date :</td>
<td> <%=date %> </td>
</tr>
</table>
</body>
</html>

Output :

When you will execute the above example you will get the output as :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics