JSP instruction elements: Page instruction, include instruction, and taglib instruction
1. Directive elements: controls the generated servlet structure.
JSP commands are used in the "conversion phase" to provide information about the entire JSP page,
Apply the include directive and the include action ID to include a file in a JSP page, respectively.hello.jspImport= "java.util.*" pageencoding= "Utf-8"%>String Path=Request.getcontextpath (); String BasePath= Request.getscheme () + "://"
The page command is usually at the top of the jsp page. Multiple page commands can be used on a jsp page. The syntax format of the page command is as follows:
[Language = "java"]
[Extends = "package. class"]
[Import = "package. class | package. *,
How do I include one HTML file inside another?
It's very common practice to have a consistent on a Web site. You might have a standard navigation bar or a logos or even just a page footer with copyright and administrative informatio N. Rather than
The include (), require () statement contains and runs the specified file. The two structures are exactly the same on the containing file, and the only difference is the handling of the error. The require () statement stops when it encounters a
include| Web pages have been built in the web. When we encounter a lot of content for static pages, and the page header and footer often to be replaced, if always use HTML files always have a lot of trouble. Because the batch modification is not
If you have duplicate code in multiple files, you can write this part of the code to a file, and then include the file in the desired place. Note that in this file, you only need these duplicate code, and do not need any other format or anything,
The include directive is the compile-time directive, where the content of the file included in the include is inserted into the JSP file when it is compiled, and the JSP engine determines that the JSP page has not been modified, otherwise it is
The "relative path" here is relative to the folder where the "keynote file" is located.
#include file#include file is followed by the "relative path" of the files, and "absolute path" is not allowed.
Use relative paths, such as: file= "Script\file.
The include directive is the compile-time directive, where the content of the files included in the include is inserted into the JSP file when compiling, and the JSP engine infers that the JSP page has not been altered, otherwise it is considered
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.