JSP compilation directives: directives are issued to the JSP container via the attribute configuration in the directive to control certain features of the JSP page
JSP Directive format: <%@ directive name [one or more instruction attributes]%>
1.page: Used to set the global properties in a JSP page
The page directive is at the top of the screen and can have multiple page directives in a JSP page, but cannot specify the same page directive
Property:
language//specifying pages using scripting language
inport//similar to Java in the guide package
session//Setting shared information validity
contenttype//setting the MIME type of a JSP page reply
istreadsafe//whether the current page supports thread safety
info//specifying JSP page text information
extends//
Buffer//jsp is compiled into a servlet Java program that sets the Java inherited parent class
autoflush//whether the buffer of the output stream is automatically cleared
errorpage//jsp pages to jump when the page is abnormal
iserrorpage//whether the current page is an error handling page
2.include: Use this directive in JSP pages to introduce external files
<%@ include file= "example.jsp"%>
3.Taglib: Use this directive to declare a new user-defined label
<%@ taglib uri= "" prefix= ""%>
Note: In the case of an action instruction and a compile instruction, the compile instruction notifies the Servlet engine of the processing message, and the action instruction is only the script action at run time. Compile instructions work when compiling a JSP into a Servlet: action commands are often replaced with Java scripts, which are standardized for JSP scripts
- Jsp:forward: Performs a page turn to forward the processing of the request to the next page.
- Jsp:param: Used to pass parameters and must be used with other supported parameter song labels.
- Jsp:include: Used to dynamically introduce a JSP page.
- Jsp:p1ugin: Used to download the Java plug-in, and the action is performed on the client.
- Jsp:usebean: Use JavaBean.
- Jsp:setproperty: Modifies the property value of the JavaBean instance.
- Jsp:getproperty: Gets the property value of the JavaBean instance.
These action instructions are explained in turn:
1.<jsp:forward page= "example.jsp" >//page properties Specify the destination page for forwarding
2.jsp:param
<jsp:include page= "example.jsp" >
<jsp:param name= "No" value= "<%=i%>"/>//add parameters to be passed when using the include and forward operations. Access request on included pages or forwarded pages to get added parameters
</jsp:include>
3<jsp:include page= "Example" flaush= "true"/>
4.<jsp:plugin type= "applet" code= "Someapplet.class" >
</jsp:plugin>
<%@ include file= ""%>
The difference: The former is executed when the JSP is converted to a servlet, and static text is introduced, and it is fused with the JSP page before it is transformed into a servlet
The latter is executed during the request processing phase and introduces the execution page or the servlet generated answer text
JSP compiler instruction, JSP action instruction