JSP instruction Element (page instruction/include instruction/taglib instruction) review finishing

Source: Internet
Author: User

Today, I reviewed the JSP instruction element section, sorted out, share with everybody:





One, page instruction: Set the global properties of the JSP page, which acts on the entire JSP page, setting including statically contained files.


<%@ Page Property 1 = "Property value 1" Property 2 = "Property value 2"%>


1, Language attribute: Declare the type of scripting language used, currently only Java one, do not reject the addition of other languages later.


<%@ page language= "java"%>


2, extends property: Specifies which parent class the servlet generated by this JSP page inherits from, and must specify the full name of the class, that is, the package name plus the class name. Less use, use caution, may limit the ability to compile JSP pages.


<%@ Page extends= "Inherited parent class"%>


3, Import property: Specifies the imported Java package, either as a class file in the directory specified in the environment variable or as a custom file in the classes directory under the Web project Web-inf. The packages that the JSP imports by default are as follows:


java.lang.*;javax.servlet.*;javax.servlet.jsp.*;javax.servlet.http.*;


<%@ page import= "Imported package name"%>


4, Session property: Specifies whether the JSP page can use the Session object, true if it can, false not, and defaults to true.


<%@ page session= "True|false"%>


5, Buffer property: Specifies whether the output stream has a buffer and sets the buffer size. None does not have buffering capability, or other specific values, the default value is 8KB.


<%@ page buffer= "none|nkb"%>


6, AutoFlush Property: Specifies whether the buffer is automatically forced output, the default is true. When True, the buffer is full when the output is still normal, and false generates an exception. cannot be set to False when the buffer is none.


<%@ page autoflush= "True|false"%>


7, IsThreadSafe property: Specify JSP page is enough to support multithreading, true when multiple threads, and can handle the request of multiple users, false is not, can only be a user, the default is true.


<%@ page isthreadsafe= "True|false"%>


8, Info property: Set the JSP page information, can be any string. This information can be obtained by Servlet.getservletinfo.


<%@ Page info= "This is a JSP page"%>


9, ErrorPage property: Jumps to a JSP file that can handle exceptions when an exception occurs.


<%@ page errorpage= "error.jsp"%>


10, Iserrorpage property: Can handle the exception JSP file. The default is False.


<%@ page iserrorpage= "True|false"%>


11, Contentype property: Specifies the MIME format of the JSP page and the encoding format of the page. The default format is iso-8859-1.


<%@ pagecontentype= "txt/html;charset= iso-8859-1"%>


12, pageencoding property: Specifies the encoding format for the Web page.


<%@ pagepageencoding= "iso-8859-1"%>


13. iselignored property: El expression is supported, true is ignored, not executed. The default is False.


<%@ pageiselignored= "Ture|false"


%>





II, include directives: Inserts a file containing text or code into the JSP file, merges the file and the current file when it is converted to a servlet, and the included file is executed, and the JSP page resumes execution.


<% @include = "included file Address"


%>


1, including text files: If you have Chinese, add contenttype properties.


as text content:


<%@


page contentype= "txt/html;charset=" gb2312%>


This is a text file.


2, contains HTML files.


such as HTML content:


<button>check</button>


3, contains JSP files.


<%date


now = new Date ();


Out.println (now);


%>





III, taglib directive: affirms that the JSP file uses a custom label.


<% @taglib


uri= "uritotaglibrary" prefix= "TagPrefix"%>


1, URI attribute: Used to specify where the tag library is stored.


2. Prefix property: Specifies the prefix that this tag library must use.


such as: <% @taglib


uri= "Http:java.sun.com/.../core" prefix= "C"%>


Use Tags: <c:out value= "This is queue!" ">

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.