Preface

Comment

Declaration

Expression

Scriptlet

EL Expression

Directives

Attribute Directive

Include Directive

Page Directive

Tag Directive

Taglib Directive

Variable Directive

Standard Actions

<jsp:attribute>

<jsp:body>

<jsp:element>

<jsp:doBody>

<jsp:forward>

<jsp:getProperty>

<jsp:include>

<jsp:invoke>

<jsp:output>

<jsp:plugin>

<jsp:root>

<jsp:setProperty>

<jsp:text>

<jsp:useBean>

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" ]	
   [ pageEncoding="characterSet | ISO-8859-1" ]	
   [ isELIgnored="true|false"]	
%>

OR

<jsp:directive.page pageDirectiveAttrList /> 

where pageDirectiveAttrList is the same as the list in the JSP syntax.

XML Syntax

<jsp:directive.page pageDirectiveAttrList /> 

where pageDirectiveAttrList is the same as the list in the JSP syntax.

Examples

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

Description

The page directive applies to an entire JSP page and any of its static include files, which together are called a translation unit. A static include file is a file whose content becomes part of the calling JSP page. The page directive does not apply to any dynamic resources; 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 a page directive with import more than once in a JSP page or translation unit.

No matter where you position the page directive in a JSP page or included files, it applies to the entire translation unit. However, it is often good programming style to place it at the top of the JSP page.

Attributes

Tip

If you need to include a long list of packages or classes in more than one JSP page, you can create a separate JSP page with a page directive that contains the import list and include that file in the main JSP page.



宏飞网络是你学习web开发、测试web程序实例、和培养职业技能的首选网站。我们提供例子也许有些简单,但对理解基本概念有帮助。

我们尽量避免在教程、参考及例子中出现错误,但不能保证所有的内容都是正确的。

你使用本网站时,我们默认你已经阅读并接受了我们的隐私政策。

Copyright 2003-2011宏飞网络 版权所有