Dynamic and Static JSP inclusion

Source: Internet
Author: User

<JSP: Include> Dynamic and Static inclusion

Dynamic include
Use the JSP: include action to implement <JSP: Include page = "added ded. JSP "Flush =" true "/> always checks for changes in the contained files. It is suitable for inclusion of dynamic pages and can contain parameters.

(Here you must use flush = "true". You cannot use false. The default value is false)
Static include
Implemented by using the include pseudo code. Changes to the included files are not checked. This applies to static pages that contain <% @ include file = "included.htm" %>
========================================================== ======================================
1. The result of static include is to introduce other JSP into the current JSP.
The dynamic include structure is independent of the two and will not be merged until the output (you can see the Java file generated by JSP)
2. it is precisely because of this that the dynamic include JSP file is highly independent. It is a separate JSP file, and the objects and page settings that need to be used must all be created by yourself. Of course, fortunately, it is consistent with the request range of the page that includes it.
Static include is simply a sharing method for writing code outside. All variables can be shared with the main file of include. The two are highly tightly integrated and cannot conflict with the same name of the variable. the page settings can also borrow the main file.

This article from: the foot home (www.jb51.net) detailed source reference: http://www.jb51.net/article/13159.htm

 

 

The include command is statically introduced, while the include action is dynamically introduced.
Static and Dynamic include are irrelevant to page content.
And <% @ include... %> the difference is that JSP: Include can pass parameters to included pages. However, if parameters are passed, the included pages must be JSP pages.
For example, passing parameters to the contained page included2.jsp:
<JSP: Include page = "included2.jsp" Flush = "true">
<JSP: Param name = "ref1" value = "AAA"/>
<JSP: Param name = "ref2" value = "BBB"/>
</Jsp: Include>
Page attribute: indicates the file to be included in the relative path.
Flush attribute: True is required, indicating that the page can be refreshed.
JSP: Param can be used to pass parameters to the included dynamic page, that is, the JSP page (but not the include command). parameters are passed in the form of a parameter name-value pair, the contained page uses request. getparameter ("parameter name") can obtain the value of the corresponding parameter

 

What is the difference between dynamic and static include in JSP? Dynamic include is implemented using JSP: include action. It always checks changes in the contained files. It is suitable for inclusion of dynamic pages and can contain parameters. Static include is implemented by using the include pseudo code and will not check the changes in the contained files. It is applicable to include static pages.

 

Reprinted link: http://blog.sina.com.cn/s/blog_5bba80460100cidt.html

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.