JSP programming (II)-Basic JSP syntax (5)-page instruction

Source: Internet
Author: User

Defines the global attributes in the JSP file.

 

Attributes include:

The JSP syntax is as follows:
<% @ Page
[Language = "Java"]
[Extends = "package. Class"]
[Import = "{package. Class | package. *},..."]
[Session = "True | false"]
[Buffer = "None | 8kb | sizekb"]
[Autoflush = "True | false"]
[Isthreadsafe = "True | false"]
[Info = "text"]
[Errorpage = "relativeurl"]
[Contenttype = "mimetype [; charset = characterset]" | "text/html; charset = ISO-8859-1"]
[Iserrorpage = "True | false"]
%>
Example
<% @ Page import = "Java. util. *, java. Lang. *" %>
<% @ Page buffer = "5kb" autoflush = "false" %>
<% @ Page errorpage = "error. jsp" %>
Description
<% @ Page %> the command acts on the entire JSP page, and also includes static inclusion files. However, the <% @ Page %> command cannot act on dynamic include files, such as <JSP: Include>

You can use multiple <% @ Page %> commands on a page, but the attributes can only be used once. However, there is an exception, that is, the import attribute. Because the import attribute is similar to the Import Statement in Java (refer to Java language), you can use this attribute several times.

No matter where you place the <% @ Page %> command in the JSP file, it applies to the entire JSP page. However, for the sake of readability and good programming habits of the JSP program, it is best to put it on the top of the JSP file.

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.