How many forms of include are available in JSP? What are the differences ?, Jspinclude

Source: Internet
Author: User

How many forms of include are available in JSP? What are the differences ?, Jspinclude

What are the include in JSP? What is the difference?

1. What are the include items in JSP?

(1) <% @ include file = "" %>

(2) <jsp: include page = "" flush = "true"/>

2. Differences

(1) The former is an indicator element, and the latter is a behavior element.

(2) The former is merged into a page, and the latter is merged into a file and then converted into a Servlet by the JSP Container


What is $ {} used in the jsp webpage? <jsp: What is different from <%, <jsp: include is different from <% include,

$ {...} It is an EL expression language that can simplify access to jsp built-in objects. It can easily implement conditional output without using JAVA programming, eliminating the need for most types of conversions. The simplest example <Body>
4 + 5 =$ {4 + 5} <br>
5*2 =$ {5*2}
</Body>
</Html>
The page displays 4 + 5 = 9
5*2 = 10
This is a simple example, but the problem is that simplified languages avoid many types of conversions.
<% Include> is a command element and static inclusion. The execution time is in the compilation phase, and the introduced content is a static file. It is integrated with the inclusion when compiled into servlet, therefore, the file of include cannot be a variable or be followed by any parameter after file.
<Jsp: include> is an action element and a dynamic inclusion. The execution time is in the request stage. The introduced content is dynamically generated when the execution page is requested and then included in the page.

In JSP pages, what are the requirements or specifications of included pages?

Repeated content should not be displayed on the page. If you really do not like it, you can use another framework, such as freemaker or sitemesh.

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.