1. JSP directive
Category: 1).page 2).include 3).taglib
Syntax: <%@ Directive Name Property 1="Value 1" ....%>
2. Page compilation command:
• Function: Use the Page compilation directive to set the page properties of JSP. Usually located at the top of a JSP page, there can be multiple page directives for the same page.
•page instruction syntax format:
<%@page
[language="Java"] //Declare the type of language used by JSP page
[extends=""] //The Java class generated when JSP program is compiled, the parent class that needs to be inherited, or the fully qualified class name of the interface that needs to be implemented.
[import=" | package.*},..."] //Used to import packages. Packages that are automatically imported by default: .*; .*; .*; .*
[session="true | false"]
[buffer="none | 8kb | size kb"]
[autoFlush="true | false"]
[isThreadSafe="true | false"]
[info="text"]
[errorPage="relativeURL"] //Specify the error handling page
[contentType="mimeType [ ;charset=characterSet]" | "text/html;charSet=ISO8859-1"]
[isErrorPage="true | false"] //Set this JSP page as an error handler
%>
3. Include compilation command
•effect:
The notification container will contain a static file during the interpretation process, and the contents of the file can be parsed by the JSP. The parsing process occurs during compilation. In JSP pages, the include directive has no limit on the number and can be used in nested ways. Nesting is theoretically unlimited, however, all pages must use the same scripting language as the pages included.
• include syntax format:
<%@ include file=”relativeURL”%>
•The benefits of using include to compile directives:
A complex JSP page can be divided into several simple, individually processed parts. This method greatly enhances the management, flexibility and expansion of JSP pages. When you want to modify the page, you can only modify the included files you want to modify separately.
•Things to note:
1) An error occurred when <%@ include file="" %> was performed in.
The error is: Multiple annotations found at this line:
- Duplicate local variable path
- Duplicate local variable
Solution:
Method I: Change the path and basepath in it to other names
Method II: Delete the path and basepath in it