HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
JSP directive to set the entire JSP page related attributes, such as page coding and scripting languages.
Syntax is as follows:
<%@ directive attribute="value" %>
The instructions may have a number of properties, which in the form of key-value pairs, separated by commas.
The three kinds of instruction JSP tags:
instruction | description |
---|---|
<% @ Page /en.%> | Custom page-dependent attributes, such as the scripting language, error pages, cache requirements, etc. |
<% @ Include /en.%> | It contains additional files |
<% @ Taglib /en.%> | The introduction of custom tag library |
Page command provides the current instructions for use page container. A JSP page can contain multiple page instructions.
Page command syntax:
<%@ page attribute="value" %>
Equivalent XML format:
<jsp:directive.page attribute="value" />
The following table lists the attributes associated with the Page directive:
Attributes | description |
---|---|
buffer | Specifies the size of the buffer objects out |
autoFlush | Out control object cache |
contentType | Specify the current MIME type and character encoding JSP page |
errorPage | Specifies an exception occurs when the JSP pages need to turn to error-handling page |
isErrorPage | Specifies whether the current page can be handled as an error page to another JSP page |
extends | Specifies where a servlet class inheritance |
import | Import Java class to use |
info | Defined description of the JSP page |
isThreadSafe | Access to specify whether the JSP page thread safe |
language | Scripting language used to define JSP page, the default is Java |
session | Specifies whether JSP pages use session |
isELIgnored | Specifies whether EL expressions |
isScriptingEnabled | It can be used to determine the script element |
JSP can contain other files include directives. Included files can be JSP files, HTML files or text files. File contains is like part of the JSP file will be compiled simultaneously executed.
Include command syntax is as follows:
<%@ include file="文件相对 url 地址" %>
include instruction in the filename is actually a relative URL address.
If you do not have to associate a file path, JSP compiler defaults to find in the current path.
Equivalent XML syntax:
<jsp:directive.include file="文件相对 url 地址" />
JSP API allows users to customize the label, a custom tag library is a collection of custom labels.
Taglib directive introduces a custom-defined set of tags, including the library path, custom labels.
Taglib command syntax:
<%@ taglib uri="uri" prefix="prefixOfTag" %>
uri attribute determines the location of the tag library, prefix attribute specifies the tag library prefix.
Equivalent XML syntax:
<jsp:directive.taglib uri="uri" prefix="prefixOfTag" />