JSP page指令

page指令用于提供指示,涉及到当前JSP页面的容器。你可以在你的JSP页面的任何地方代码页指令。按照惯例,page指令进行编码的JSP页面的顶部。

以下是page指令的基本语法:

<%@ page attribute="value" %>

您可以编写XML相当于上面的语法如下:

<jsp:directive.page attribute="value" />

属性:

以下是page指令相关联的属性的列表:

属性 目的
buffer Specifies a buffering model for the output stream.
autoFlush Controls the behavior of the servlet output buffer.
contentType Defines the character encoding scheme.
errorPage Defines the URL of another JSP that reports on Java unchecked runtime exceptions.
isErrorPage Indicates if this JSP page is a URL specified by another JSP page's errorPage attribute.
extends Specifies a superclass that the generated servlet must extend
import Specifies a list of packages or classes for use in the JSP as the Java import statement does for Java classes.
info Defines a string that can be accessed with the servlet's getServletInfo() method.
isThreadSafe Defines the threading model for the generated servlet.
language Defines the programming language used in the JSP page.
session Specifies whether or not the JSP page participates in HTTP sessions
isELIgnored Specifies whether or not EL expression within the JSP page will be ignored.
isScriptingEnabled Determines if scripting elements are allowed for use.

buffer 属性:

buffer 属性指定服务器输出的响应对象缓冲特性。

你可以编写“none”值来指定没有缓冲,使所有servlet的输出立即定向到响应对象,或者您可以编写一个最大缓冲区大小以KB为单位写入到响应之前,它指示的servlet写入缓冲区对象。

可直接进行servlet来写直接输出到响应输出对象,使用以下命令: