Get the App
SLTechnology News&Howtos  ›  Development  › 

What does include mean in jsp

Shulou Source: shulou.com Published: 2022-06-03 14:53:45 10月04日 Update

This article mainly explains "what is the meaning of include in jsp". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what does include mean in jsp"?

Elements allow you to include dynamic files and static files, and the results of these two include files are different. If the file is only static, then this inclusion simply adds the contents of the included file to the jsp file, and if the file is dynamic, the included file will also be executed by the Jsp compiler (similar to asp).

You can't tell from the file name whether a file is dynamic or static. For example, aspcn.asp may just contain some information and does not need to be executed. You can process both files at the same time, so you don't need to include them to determine whether the file is dynamic or static.

If the include file is dynamic, you can also pass parameter names and values using the.

Attribute

Page= "{relativeURL |}"

The parameter is a relative path, or an expression that represents a relative path.

Flush= "true"

Here you must use flush= "true", you cannot use false value. The default value is false

< jsp:param name="parameterName" value="{parameterValue | }" />

+

Clause allows you to pass one or more parameters to a dynamic file

You can use more than one page to pass multiple parameters.

There are two forms of include in jsp, which are

< %@ include file=" "%>

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

The former is the instruction element and the latter is the behavior element. You can usually consider using include when some parts of all pages in your application, such as title, footer, and navigation bar, are the same. The include instruction element of jsp reads the contents of the specified page And integrate these contents with the original page. (this process takes place during the translation phase, when jsp is converted into servlet.)

There are two main differences between include and jsp:include.

One: in terms of execution time:

< %@ include file="relativeURI"%>

It is executed in the translation phase.

< jsp:include page="relativeURI" flush="true" />

It is executed in the request processing phase.

Second, the difference in the content of introduction:

< %@ include file="relativeURI"%>

Introduce static text (html,jsp) to blend with JSP pages before they are converted to servlet.

Introduce the response text generated by the execution page or servlet.

In addition, in both uses, the file and page attributes are interpreted as a relative URI. If it begins with a slash, then it is an environment-dependent path. It is interpreted according to the prefix of the URI assigned to the application, and if it does not start with a slash, then it is the path associated with the page, which is interpreted according to the path of the page that introduced the file.

Thank you for your reading, the above is the content of "what does include in jsp mean?" after the study of this article, I believe you have a deeper understanding of what include means in jsp, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: File page content dynamic parameter path static meaning element stage different multiple that is learning interpretation attributes application beginning instruction text Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB macOS Shulou Technology Redmi MySQL