Introduction to include action directives in JSP

Source: Internet
Author: User

1. Introduction

Include action directives can dynamically include a file in a JSP page, the contents of which can be static files or dynamic scripts, and the JSP engine can dynamically compile and update the included dynamic files when they are modified. If the inclusion file is dynamic, you can also pass the parameter name and parameter values with <jsp:param>.


2. JSP syntax
<jsp:include page= "{relativeurl | <%= expression%>}" flush= "true"/>
Or
<jsp:include page= "{relativeurl | <%= expression%>}" flush= "true" >
<jsp:param name= "ParameterName value=" {parametervalue | <%= expression%>} "/>+
</jsp:include>

2.1 Properties
Page= "{relativeurl | <%= expression%>}", the argument is a relative path, or an expression that represents a relative path.
Flush= "true", where you must use Flush= "true", you cannot use false values. The default value is False
<jsp:param name= "ParameterName" value= "{parametervalue | <%= expression%>}"/>+,<jsp:param> clause allows you to pass one or more parameters to a dynamic file, and you can use multiple <jsp:param> in one page to pass multiple parameters.


3, Example

3.1 contains dynamic files

<jsp:include page= "scripts/login.jsp"/>

3.2 contains static files
<jsp:include page= "copyright.html"/>
<jsp:include page= "/index.html"/>

3.3 Pass <jsp:param> Pass parameters
<jsp:include page= "scripts/login.jsp" >
<jsp:param name= "username" value= "jsmith"/>
</jsp:include>


Reference: Baidu Encyclopedia


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.