Home > Java > javaTutorial > body text

jsp include what does it mean

(*-*)浩
Release: 2020-09-19 13:52:04
Original
4198 people have browsed it

Include in jsp allows the inclusion of dynamic files and static files. It has two forms, namely: 1. "<%@ include file=" "%>", which represents the instruction element; 2. "< ;jsp:include page=” ” flush=”true”/>”, indicating behavioral elements. The

jsp include what does it mean

# element allows you to include dynamic files and static files. The results of these two include files are different. If the file is only a static file, then this inclusion only adds the content of the included file to the jsp file. If the file is dynamic, then the included file will also be executed by the Jsp compiler (all this is similar to asp ).

You cannot judge whether a file is dynamic or static from the file name. For example, aspcn.asp may just contain some information and does not need to be executed. can handle both types of files at the same time, so you don’t need to judge whether the file is dynamic or static when including it.

If the included file is dynamic, then you still need to You can use to also pass parameter names and parameter values.

Attribute

page="{relativeURL | <%= expression %>}"
Copy after login
The parameter is a relative path, or an expression representing a relative path.

flush="true"

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

<jsp:param name="parameterName" value="{parameterValue | <%= expression %> }" />+
Copy after login
The clause allows you to pass one or more parameters to the dynamic file

You can use multiple in one page to pass multiple parameters.

There are two forms of include in jsp, namely

<%@ include file=” ”%>
<jsp:include page=” ” flush=”true”/>
Copy after login
The former is an instruction element and the latter is a behavioral element. Usually you can consider using include when certain parts (such as headers, footers, and navigation bars) are the same for all pages in the application. <%@ include file=” ”%>, the include directive element of jsp reads the content of the specified page. And integrate these contents with the original page. (This process is carried out during the translation stage: that is, the stage when jsp is converted into servlet.)

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

1: Execution time Above:

<%@ include file=”relativeURI”%> is executed during the translation phase

Executed in the request processing phase.

2: Introduction of different contents:

<%@ include file=”relativeURI”%>

Introduce static text (html, jsp), integrated with the JSP page before it is converted into a servlet.

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

Also in both usages the file and page attributes are interpreted as a relative URI. If it starts with a slash, then it is an environment-related path. Will be assigned to the application according to The prefix of the URI is interpreted. If it does not start with a slash, then it is the path related to the page. It is interpreted according to the path of the page where this file is introduced.

The above is the detailed content of jsp include what does it mean. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
jsp
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template