Detailed description of JSP Compilation instruction page and include

Source: Internet
Author: User

1. JSP commands

Category: 1). page 2). include 3). taglib

Syntax: <% @ command name attribute 1 = "value 1"... %>

2. Page compilation command:

• Purpose: Use the Page compilation command to set the Page attributes of JSP. Usually located at the top of the JSP page, you can have multiple page commands for the same page.
• Page command syntax format:
Copy codeThe Code is as follows:
<% @ Page

[Language = "Java"] // declare the type of language used for JSP pages

[Extends = "package. class"] // Java class generated during JSP program compilation, the parent class to be inherited, or the fully qualified class name of the interface to be implemented

[Import = "package. class | package. *},..."] // import the package. Automatically imported packages by default: java. lang. *; javax. servlet. *; javax. servlet. jsp. *; javax. servlet. http .*

[Session = "true | false"]

[Buffer = "none | 8kb | size kb"]

[AutoFlush = "true | false"]

[IsThreadSafe = "true | false"]

[Info = "text"]

[ErrorPage = "relativeURL"] // specifies the error handling page

[ContentType = "mimeType [; charset = characterSet]" | "text/html; charSet = ISO8859-1"]

[IsErrorPage = "true | false"] // sets this JSP page as an error handler

%>

3. Include compilation instructions

• Role:
The notification container will include a static file during the interpretation of the current JSP page, and the file content can be parsed by JSP during compilation. On the JSP page, the include command has no limit and can be nested. Theoretically, nesting is unrestricted. However, all pages must use the same script language as include pages.

• Include syntax format:
<% @ Include file = "relativeURL" %>

• Benefits of using include to compile commands:
A complex JSP page can be divided into several simple parts that can be processed separately. This method greatly enhances the management, flexibility, and extended type of JSP pages. When you want to modify a page, you can only modify the contained files to be modified.

• Note:
1) <% @ include file = "test2.jsp" %> error in test1.jsp.

Error: Multiple annotations found at this line:
-Duplicate local variable path
-Duplicate local variable

Solution:

Method I: Change path and basepath in test2.jsp to another name.

Method II: delete path and basepath in test2.jsp

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.