JSP compiler instruction, JSP action instruction

Source: Internet
Author: User

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

    1. Jsp:forward: Performs a page turn to forward the processing of the request to the next page.
    2. Jsp:param: Used to pass parameters and must be used with other supported parameter song labels.
    3. Jsp:include: Used to dynamically introduce a JSP page.
    4. Jsp:p1ugin: Used to download the Java plug-in, and the action is performed on the client.
    5. Jsp:usebean: Use JavaBean.
    6. Jsp:setproperty: Modifies the property value of the JavaBean instance.
    7. 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

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.