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