The general format is <%@ directive Name property 1 = "Property Value" Property 2 = "Property value" ...%>
There are three types of directive names: Page,include,taglib
<%@ Page [language="Java"] [contenttype="Mimetype;charset=charset"] [import="{package.class|pageage.*},..."] [pageencoding="CHARSET"] [extends="Package.class"] [session="True|false"] [errorpage="Relativeurl"] [buffer="None|8kb|size KB] [Autoflush=]true|false" ] [Isthreadsafe=]true|false" ] [Info=]Text" ] [Iserrorpage=]true|false" ] [Iselignored=]true|false"]%>
Language property: Sets the language used by the JSP script in the current page, the default value is Java
ContentType property: Sets the MIME type of the page response, usually set to text/html
Import Property: The Import property is similar to the import statement in Java, which is used to import the required packages into the JSP file. This property can be used multiple times in a page directive to import multiple packages
Extends properties:
The extends property is used to specify a class that inherits after converting a JSP page to a servlet
Session Properties:
The default value of this property is true, indicating that the current page supports session, set to False to not support session
Buffer property:
This property is used to set the size of the buffer used by the Out object (the JspWriter class object). If set to None, indicates that the cache is not used
Info property:
This property can be set to any string, such as the author of the current page or other related page information
ErrorPage Properties:
This property is used to specify the page to invoke when an exception occurs on the current page. If the property value is a path that begins with "/", the file will be located at the root of the current application, otherwise the file will be located in the directory of the current page.
Pageencoding Properties:
This property is used to set the encoding of JSP page characters. The default value is Iso-8859-1.
Include directives
<%@ include file= "absolute path or relative path to file"%>
This directive is used to embed other files in the current JSP page where the instruction is currently being used, and displays the result of code execution if there is executable code in the contained file
TAGLIB directive
<%@ taglib uri= "Taguri" prefix= "TagPrefix"%>
By using the TAGLIB directive, developers can use some basic or custom logos on the page to accomplish special functions, typically using the label of the JSTL standard tag Library
Jstl Tag Function Library
For example: <%@ taglib uri= "Http://java.sun.com/jsp/jstl/core" prefix= "C"%> is a label that uses the core standard library
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
JSP's 3 big instructions Page,include,taglib