The difference between include and jsp:include

Source: Internet
Author: User
We all know that there are two types of include in JSP, namely
<%@ include file= ""%>
<jsp:include page= "" flush= "true"/>
The former is the instruction element, the latter is the behavior element. Where exactly are they going to be used? How to use and what is the difference between them? This should be a problem that many people see it all come to mind

One: The execution time:
<%@ include file= "relativeuri"%> is executed during the translation phase
<jsp:include page= "Relativeuri" flush= "true"/> is executed during the request processing phase.

Two: The introduction of different content:
<%@ include file= "Relativeuri"%>
Introduces static text (html,jsp), which is incorporated into a JSP page before it is transformed into a servlet.
<jsp:include page= "Relativeuri" flush= "true"/> Introduces the answer text generated by the execution page or servlet.
In addition, the file and page properties are interpreted as a relative URI in both usages. If it starts with a slash, it is an environment-dependent path. It is interpreted according to the prefix of the URI assigned to the application, if it does not start with a slash, then it is the page-dependent path. This is explained by the path to the page where the file was introduced.

The difference between include and jsp:include

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.