Java Learning -035-javaweb_004--JSP include directive

Source: Internet
Author: User

The inclue directive is to insert different files into a JSP Web page, which can be a text file, an HTML file, a JSP file, and the instruction syntax is as follows:

<% @include file= "relative path"%>

A few files are created below to demonstrate the include directive, as shown in the following directory structure:

WebApps    |--jsp         |--include.jsp         |--include_file.jsp         |--index.html         |--source_txt                  |-- Include.txt

The contents of the include.jsp file are as follows:

<% @page    language= "java"    import= "java.util.*"    session= "true"    contenttype= "text/html;charset= Utf-8 "    buffer=" 32kb "%>

The contents of the include_file.jsp file are as follows:

<% @page    language= "java"    import= "java.util.Date"    session= "true"    contenttype= "text/html; Charset=utf-8 "    buffer=" 32kb "%>

The contents of the index.html file are as follows:

The contents of the Include.txt file are the lyrics of winter secrets.

To start Tomcat, in the browser address bar type: http://localhost:8080/jsp/include.jsp, the page appears as follows:

At this point, Java Learning -035-javaweb_004-JSP include instructions to the end, I hope this article can give beginners javaweb you a reference.

Finally, very grateful to the pro-stop, I hope this article can be pro helpful. Warmly welcome the kiss to discuss together and progress together. Thank you so much! ^_^

Java Learning -035-javaweb_004--JSP include directive

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.