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

Source: Internet
Author: User
Today, I reviewed the JSP instruction element section, sorted out, and shared with you:

One, page instruction:Sets 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: Affirm the type of scripting language used, currently only Java one, do not reject the addition of other languages.
<%@ 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 properties: Specify whether the JSP page can use the Session object, True can, false is not, the default is 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, while able to 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 the JSP file that can handle the exception when an exception occurs.
<%@ page errorpage= "error.jsp"%>
10, Iserrorpage property: Whether the exception can handle the 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: Specify the encoding format of 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"
%>

Two, include directive: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 completes the included file before the JSP page resumes execution.
<% @include = "included file Address"
%>
1, include text file: If have Chinese, add contenttype attribute.
such as text content:
<%@
Page contentype= "txt/html;charset=" gb2312 "%>
This is a text file.
2, including HTML files.
such as HTML content:
<button>check</button>
3, including JSP files.
<%date
now = new Date ();
Out.println (now);
%>

Third, taglib directive:Declare that the JSP file uses a custom label.
<% @taglib
Uri= "Uritotaglibrary" prefix= "TagPrefix"%>
1, URI properties: To specify the location of the tag library.
2. Prefix property: Specifies the prefix that this tag library must use.
such as: <% @taglib
Uri= "Http:java.sun.com/.../core" prefix= "C"%>
Using 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.