当前位置:网站首页>What attributes and methods are available for page directives in JSP pages?
What attributes and methods are available for page directives in JSP pages?
2022-08-02 08:37:00 【qq_25073223】
From:
What attributes and methods are available for page directives in JSP pages?
The following author will describe the various attributes of the page directive in JSP, as follows:
The purpose of the page directive
page directive: used to set various properties of the jsp page no matter where the page directive appears in the jsp page, it acts on the entire jsp page. Usually wePut the page directive at the head of the pageCommon attributes of the page directive
<%@page[language="java"][extends="package.class"][import="{package.clas|package.*},..."][contenType="TYPE;charset=CHARSET"][session="True|False"][buffer="none|8kb|sizekb"][autoFlush="True|False"][isThreadSafe="True|False"][info="text"][isErrorPage="True|False"]%>[language="java"]
Declare the kind of scripting language the JSP page belongs to
java by default
[extends="package.class"]
Set the superclass of the servlet generated by the JSP page. This attribute is generally reserved for developers or providers.
This attribute should be avoided unless referring to a class provided by the server provider specifically for this purpose.
[import="{package.clas|package.*},..."]
Use the import attribute of the page directive to specify the package that the servlet that the JSP page converts into should import
In JSP, the package is absolutely required
Notes:When no package is used, the system considers that the referenced class is in the same package as the current classBy default, servlets import some server-specific packages, for example: java.lang.* javax.servlet.* javax.servlet.jsp.* javax.servlet.http.* is imported at compile timeno need to specifyexample:<%@ page import="package.class" %><%@ page import="package.class1, ..., package.classN" %><%@ page import="java.uti1.*, com.java265.*" %>
[contenType="TYPE;charset=CHARSET"]
The contentType attribute sets the Content-Type response header, indicating the MIME type of the document to be sent to the client program.
The default MIME type is text/html, and the default character set is ISO-8859-1
Example: Modify the contentType:
<%@ page contentType="text/html" %>;Change character set:<%@ page pageEncoding="GBK" %>;Change content type and character set:<%@ page contentType="text/html; charset=utf-8" %>
[session="True|False"]
Set whether the page participates in the HTTP session.The default value is true
If there is an existing session, the predefined variable session (of type HttpSession) should be bound to the existing session;
Otherwise, create a new session and bind it to session
A value of false means no session is created automatically
Access to the variable session causes an error when the JSP page is converted to a servlet
Note that session="false" does not disable session tracking
It just prevents the JSP pageCreate new sessions for users who don't already have sessions
[buffer="none|8kb|sizekb"]
The size of the buffer is used by the out object to cache the executed JSP output to the client browser
none means that there is no cache, and it is directly output to the client browser
The user can specify the buffer'ssize to specify the size of the cache processing, the default value is 8kb
[autoFlush="True|False"]
Controls whether the output buffer should be automatically emptied when the buffer is full (default true)
or throw an exception if the buffer overflows (autoFlush="false")
in buffer="none", the false value is not valid.
[isThreadSafe="True|False"]
Set whether the JSP file is multi-threaded
When this property is set to True, a JSP can handle multiple user requests at the same time. The default value is True.
[info="text"]
Defines a string that can be obtained by the getServletInfo method in the servlet
When the JSP is executed, it is used to describe the relevant information of the current JSP file.
[isErrorPage="True|False"]
Whether to use exception object
Example
<%@pagelanguage="java"import="java.util.*"session="true"contentType="text/html;charset=utf-8"buffer="32kb"%>JSP page directive JSP page directive
边栏推荐
- Biotin-EDA|CAS:111790-37-5| 乙二胺生物素
- Biotin-C6-amine|N-生物素基-1,6-己二胺|CAS:65953-56-2
- Biotin-EDA|CAS:111790-37-5| Ethylenediamine biotin
- Biotin hydrazide HCl|CAS:66640-86-6|生物素-酰肼盐酸盐
- 【C】关于柔性数组.简要的谈谈柔性数组
- Database triggers and transactions
- Biotin-C6-amine|N-biotinyl-1,6-hexanediamine|CAS: 65953-56-2
- 【电子电路】长按键拉低电平,适用在有休眠机制的MCU但是没有看门狗,一个按键多个功能场景下使用
- 为什么都推荐使用wordpress, 而不是 phpcms 这些国内的CMS呢?
- Biotinyl Cystamine|CAS:128915-82-2|生物素半胱胺
猜你喜欢

Redis分布式锁入门

PyCharm使用教程(详细版 - 图文结合)

HCIP9_BGP增加实验

图扑软件数字孪生油气管道站,搭建油气运输管控平台

OneNote 教程,如何在 OneNote 中创建更多空间?

CASA模型、CENTURY模型应用与案例分析

Shell变成规范与变量

Redisson报异常attempt to unlock lock, not locked by current thread by node id解决方案

cas: 139504-50-0 Maytansine DM1|Mertansine|

etcd implements large-scale service governance application combat
随机推荐
Ansible 学习总结(11)—— task 并行执行之 forks 与 serial 参数详解
C语言_条件编译
EPSANet: An Efficient Pyramid Split Attention Block on Convolutional Neural Network
Seleniu screenshots code and assign name to the picture
Biotin-C6-amine|N-biotinyl-1,6-hexanediamine|CAS: 65953-56-2
CASA模型、CENTURY模型应用与案例分析
三维体尺测量
优炫数据库的逻辑复制怎么样?
【C】关于柔性数组.简要的谈谈柔性数组
mysql去除重复数据
软件测试技术之解析图灵测试离我们还有多远
MySQL压缩包方式安装,傻瓜式教学
shell中计算命令详解(expr、(())、 $[]、let、bc )
Wang Xuegang - compiled shipment line file
IO process thread -> process -> day4
BGP solves routing black hole through MPLS
如何开启mysql慢查询日志?
如何建立私域流量?私域流量对企业有什么好处?
Elasticserch 自定义字段,用户会频繁的创建和删除字段,怎么设计mapping?
WebGPU 导入[2] - 核心概念与重要机制解读