[Top] [Prev] [Next] [Bottom]

Page Directive

Defines attributes that apply to an entire JSP page.

JSP Syntax

<%@ page  
	[ language="java" ]
	[ extends="package.class" ] 
	[ import= "{ package.class | package.* }, ..." ]
	[ session="true|false" ]
	[ buffer="none|8kb|sizekb" ]
	[ autoFlush="true|false" ] 
	[ isThreadSafe="true|false" ]
	[ info="text" ]
	[ errorPage="relativeURL" ]
	[ contentType="mimeType [ ;charset=characterSet ]" | 
		"text/html ; charset=ISO-8859-1" ]
	[ isErrorPage="true|false" ]


<%@ page import="java.util.*, java.lang.*" %>
<%@ page buffer="5kb" autoFlush="false" %>
<%@ page errorPage="error.jsp" %>


The page directive applies to an entire JSP file and any static files it includes with the Include Directive or <jsp:include>, which together are called a translation unit. Note that the page directive does not apply to any dynamic included files; see <jsp:include> for more information.

You can use the page directive more than once in a translation unit, but you can only use each attribute, except import, once. (Because the import attribute is similar to the import statement in the Java programming language, you can use it more than once, just as you would use multiple import commands in the Java programming language) No matter where you position the page directive in the JSP file or included files, it applies to the entire translation unit. However, it is usually good programming style to place it at the top of the file.


[Top] [Prev] [Next] [Bottom]

Copyright © 1999, Sun Microsystems, Inc. All rights reserved.