Introduction to JSP Directive elements

Source: Internet
Author: User
Tags execution expression include interface variable
JS instruction Element (directives Elements)

Instructions are mainly used to provide information about the entire JSP page, and to set the relevant properties of JSP pages.

One, page instruction

Function: Set the properties of the entire JSP Web page and related functions.
Syntax: <%@ page attribute1= "value1" attribute2= "value2"%>
Label element: -->


Properties of the page directive element
Language= "Language" specifies what language the JSP container will use to compile the JSP Web page. You can only use the Java language at this time, but adding additional languages is not excluded. The default value is java.
extends= "ClassName" defines which parent class the servlet that the JSP page produces is inherited from. Must be a class that implements the Httpjsppage interface. The JSP specification warns you to use this property when you do not fully understand its implicit meaning.
import= "Importlist" defines which Java APIs this JSP page can use. List one or more full class names in comma-delimited lists. This list is used to create the appropriate import statements in the generated Java servlet. The following packages are automatically included and do not have to be indicated: java.lang.*;java.servlet.*;java.servlet.jsp.*;java.servlet.htt.*
Session= "True|false" indicates whether the JSP page requires an HTTP session, and if true, the resulting servlet will contain code to create an HTTP session (or access an HTTP session), and the default is true.
Buffer= "None|size in KB" Specifies the size of the output stream cache. Valid values are nkb or not. The default is 8KB.
Authflush= "True|false: Determines whether the output stream's buffer is to be automatically purged. When the cache is full when the value is true, the buffer full throws an overflow exception when the value is false. The default value is true.
Isthreadsafe= "true" this JSP page handles synchronization requests from multiple threads, true or false, and the generated servlet indicates that it implements the Singlethreadmode interface. Singlethreadmode has declared disapproval of use (deprecate)
info= "Text" indicates information about this JSP page, which is returned by the Getservletinfo () method.
Iserrorpage= "True|false" true if this page is used as a page to handle an exception error. In this case, the page can be specified as the value of the ErrorPage property in the other page instruction element. Specifying this property to True causes the exception implied variable to be available for this page. The default value is False.
Errorpage= "Error_url" indicates that if an exception error occurs, the page will be pointed back to a URL page. The error page must specify Iserrorpage= "true" in its page directive element
Contenttype= "Ctinfo" represents the MIME type and optional character decoding that will be used in the build servlet.
Pageencoding= "Ctinfo" indicates how the JSP page is encoded.
Iselignored= "True|false" indicates whether an El expression is executed or ignored in this JSP Web page. If true, the JSP container ignores the EL expression.

Two, include instruction

Function: Inserts a file containing the JSP at compile time. The included procedure is static and contains files that can be JSP, HTML, text, or Java programs.
Syntax: <%@ include file= "Relativeurlspec"%>
Label element:
Note: There are two different aspects of the include directive element and the behavior element.
1.include directives are statically contained, execution times are performed at compile time, and the introduced content is static text, which is merged with the containing when being translated into a servlet. So file cannot be a variable, and it cannot be replaced with a parameter after file. The
2.include behavior is dynamically contained, execution time is performed during the request phase, and the introduced content is dynamically generated and included in the page when the page is executed when it is requested.

Three, taglib directives

Features: Use the tag library to define new custom labels, and enable custom behavior in JSP pages.
Syntax: <%@ taglib uri= "Tablibraryuri"  prefix "TagPrefix"  %>
Label element:

 
Page directive element properties          the URI of the
uri= "Taglibraryuri"      Tag Library descriptor, The main point is that the Taglibrary storage location.        
prefix= "TagPrefix"      is used to identify a unique prefix that uses custom labels in the back section of the page.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.