JSP basic Knowledge _3

Source: Internet
Author: User

One. JSP directives

1. Introduction

Designed for the JSP engine, without producing visible output, telling the engine how to handle the rest of the JSP page

Basic syntax:

<%@ directive Property name = "Value"%> ( Note: The Property name section is case sensitive )

When you configure multiple properties of a directive, you can divide it into multiple lines, or you can write a

There are three kinds of instructions, page, include and taglib

2.page instruction

The page directive is used to define the various properties of a JSP page , which acts on the entire JSP page, usually in the starting position of the entire JSP page

1<%@ Page2[Language= "Java"]//Specify the language, but the only valid value is "Java"3[extends= "Package.class" ]      4[Import= "{Package.class | package.*}, ..."]//Guide Pack5[session= "true | false"]//Whether the current JSP allows session,session hidden objects to be used in the JSP, specifying whether to produce HttpSession objects6[buffer= "none | 8kb | sizekb" ]   //7[Autoflush= "true | false" ]8[Isthreadsafe= "true | false" ]9[info= "Text" ]Ten[errorpage= "Relative_url"]//Specify the actual response page when the current page error occurs One[Iserrorpage= "true | false"]//Specify the page as the error screen, you can use exception to hide the object A[contenttype= "MimeType [; Charset=characterset]" | "Text/html; Charset=iso-8859-1 "]//Specifies the page response type, and the JSP value is text/html;charset= . -[Pageencoding= "CharacterSet | Iso-8859-1 "]//page encoding, usually consistent with charset values in ContentType -[Iselignored= "true | false"]//Specifies whether an El expression can be used the%>

ErrorPage and Iserrorpage Properties additional instructions:

The setting value of the ErrorPage property must use a relative path , which, if preceded by "/", indicates relative to the current Web application's root directory (note that it is not the site root), otherwise it is represented relative to the current page .
You can use the <error-page> element in the Web. xml file to set the error-handling page for the entire application, where the <exception-type> child element specifies the fully qualified name of the exception class.

The <location> element specifies the path to the error-handling page that begins with "/" . If you set the ErrorPage property of a JSP page, the error handling set in the Web. xml file will not work for that page .

Iserrorpage: Specifies whether the current page is an error handling page, and if true, you can use exception to hide the variable; Note If you set true and use the exception method, you generally cannot access the page directly

JSP basic Knowledge _3

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.