Differences between include directives and include behaviors in a JSP

Source: Internet
Author: User
Tags flush

We all know that there are two forms of include in JSP, namely

<%@ include file= ""%>

< Jsp:include page= "" flush= "true"/>

The former is the instruction element and the latter is the behavioral element. Where exactly will they be used? How do they differ from what they are? This should be a problem that many people will think of when they see it. Let's take a look below.

Typically, when parts of all pages in an application, such as headers, footers, and navigation bars, are the same, we can consider using include. When to use the <%@ include file= ""%>, and when to use < Jsp:include page= "" flush= "true"/> this form. The first thing to understand is the difference between them. Only by understanding the differences in their usage can we understand when to use and how to choose.

The include directive elements of the <%@ include file= ""%>,jsp read the contents of the specified page. and combine the content with the original page. (This process is in the translation phase: that is, the JSP is translated into a servlet stage.)

Here is a description of the translation phase: we know that JSP pages can not be passed intact to the browser, all JSP elements must first be processed by the server. This is done by conveying the JSP page into a servlet and then executing the servlet. The server needs a JSP container to process JSP pages. JSP containers are typically implemented in the form of a servlet, which is configured to handle all requests for JSP pages.

The JSP container is responsible for translating the JSP page into a servlet, called a JSP page implementation class? JSP Page Implementation Class), and compile this servlet. These two steps constitute the translation phase.

From this we will know: The JSP page is the content of the page specified by the Include instruction element (that is, the code snippet) is added to the JSP page that introduces it, and the JSP container converts it into a servlet after the synthesis of a file. You can see that this will result in a temporary class file and a Java 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.