`
dickyzhu
  • 浏览: 111862 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

jsp:include and include directive

 
阅读更多
1.The <include> element allows you to include either a static or dynamic file in a JSP file. The results of including static and dynamic files are quite different. If the file is static, its content is included in the calling JSP file. If the file is dynamic, it acts on a request and sends back a result that is included in the JSP page. When the include action is finished, the JSP container continues processing the remainder of the JSP file. 2.The directive inserts a file of text or code in a JSP file at translation time, when the JSP file is compiled. When you use the directive, the include process is static. A static include means that the text of the included file is added to the JSP file. The included file can be a JSP file, HTML file, or text file. If the included file is a JSP file, its JSP elements are translated and included (along with any other text) in the JSP file. Once the included file is translated and included, the translation process resumes with the next line of the including JSP file. The included file can be an HTML file, a JSP file, a text file, or a code file written in the Java programming language. Be careful that the included file does not contain , , , or tags. Because the entire content of the included file is added to the including JSP file, these tags would conflict with the same tags in the including JSP file, causing an error. eg. Header.jsp Welcome!!! Contact.jsp <include page="Header.jsp"></include> difference between include directive and jsp:include there will be in the _jspService method of Contact_jsp.java. org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "Header.jsp", out, false); and Header_jsp.java file . if change the <include page="Header.jsp"></include> as there will be static { _jspx_dependants = new java.util.ArrayList(1); _jspx_dependants.add("/Header.jsp"); } at the declaration. and Header_jsp.java file does not exist.the info in the Header.jsp file will all insert into and in Contact_jsp.java </include>
分享到:
评论

相关推荐

    关于JSP的PPT教程.ppt

    - `include`指令在JSP转换阶段就将内容嵌入,而`jsp:include`动作在客户端请求时才动态包含。 - `jsp:forward`动作将请求传递给新的资源,原始请求不再继续处理。 这些指令和动作构成了JSP的核心,使得开发者能够...

    JSP学习 入门总结 语法总结 用法总结

    等价的XML表达是`&lt;jsp:directive.include file="url" /&gt;`。 - **page指令**:`&lt;%@ page att="val" %&gt;`,用于设置JSP页面的全局属性,如import、contentType、session等。例如,设置页面编码类型可以写为`;charset=...

    JSP动作和指令.ppt

    - 动态包含其他JSP页面或HTML文件,与Include Directive不同,它在请求处理时进行包含,且支持传递参数。 5. **jsp:forward**: - 将请求转发给另一个JSP页面或Servlet,不再返回当前页面的内容,而是直接返回...

    JSP期末考试题参照.pdf

    c) jsp:include d) jsp:forward 18) Servlet过滤器通过实现(a)接口来定义其行为。(选择一项) a) javax.servlet.Filter b) javax.servlet.http.HttpServlet c) javax.servlet.jsp.JspServlet d) javax.servlet....

    jsp学习 知识ppt

    1. **编译器指令(DIRECTIVE)**:例如`*" %&gt;`, 这类指令用于配置JSP页面的属性,如设置编码、导入包等。 2. **脚本语法(SCRIPTING)**:包括HTML注释、隐藏注释、声明、表达式和脚本段。例如,`&lt;%=Msg%&gt;`用于在页面上...

    jsp--jsp的初步认识

    3. **JSP指令**:JSP提供三种类型的指令,包括页面指令(page directive)、包含指令(include directive)和标签库指令(taglib directive)。页面指令如`&lt;%@ page %&gt;`用于设置页面属性,包含指令如`&lt;jsp:include&gt;`...

    jsp程序代码

    例如,`&lt;jsp:directive.page&gt;`用于设置页面属性,`&lt;jsp:scriptlet&gt;`用于插入Java代码片段,而`&lt;%= expression %&gt;`则用于输出表达式的值。 2. **JSP指令** - `page指令`: 定义整个JSP页面的属性,如语言、导入的包...

    JSP api html格式

    4. **&lt;jsp:directive.include&gt;**:等同于&lt;%@ include %&gt;,用于包含文件。 **JSP表达式和脚本元素** 1. **JSP表达式**(${expression}):将Java表达式转换为字符串并输出到页面。 2. **JSP声明**(! declaration %...

    jsp语法(jsp脚本元素、jsp指令和jsp动作)

    JSP的主要组成部分包括:脚本元素(Scripting Element)、指令(Directive)和动作(Action)。 #### 二、JSP脚本元素 JSP脚本元素用于嵌入Java代码,这些代码最终会成为由JSP页面转换生成的Servlet的一部分。脚本元素...

    jsp课件

    2. **包含指令**(Include Directive):以`&lt;jsp:include&gt;`标签实现,可以动态地将一个文件包含到JSP页面中。 3. **页面声明**(Declaration):以`! %&gt;`定义,用于声明变量或方法,这些在JSP页面的生命周期内都是...

    JSP基础教程(清华版)

    - `jsp:directive`:用于设置页面级属性,如导入Java包、指定语言等。 - `jsp:expression`:用于输出表达式结果,通常以`${...}`表示。 - `jsp:scriptlet`:包含Java代码片段,通常以`&lt;%...%&gt;`包裹。 - `jsp:...

    JSP案例开发集锦源代码.rar

    3. **JSP指令**:包括`&lt;jsp:directive.page&gt;`(页面指令)、`&lt;jsp:directive.include&gt;`(包含指令)和`&lt;jsp:directive.taglib&gt;`(标签库指令)。它们用于设置页面属性,引入其他文件或定义自定义标签库。 4. **EL...

    jsp设计内容详细代码完整

    主要的元素包括`&lt;jsp:directive&gt;`、`&lt;jsp:expression&gt;`、`&lt;jsp:scriptlet&gt;`、`&lt;jsp:declaration&gt;`和`&lt;jsp:action&gt;`。例如,`&lt;% %&gt;`用于插入Java代码片段,`&lt;%= %&gt;`用于输出表达式的值。 2. **JSP指令(Directives)...

    jsp.rar_JSP实验报告_jsp 实验报告

    - **指令**:如`&lt;%@ page %&gt;`, `&lt;%@ include %&gt;`, `&lt;jsp:directive&gt;`等,用于设置页面属性或引入其他资源。 - **脚本声明**:在`! %&gt;`之间,用于定义变量或方法,它们在服务器端执行。 - **表达式**:在`&lt;%= %&gt;`之间...

    JSP教程和程序设计PPT课件

    JSP文件本质上是一个HTML文件,其中包含特殊的JSP元素,如`&lt;jsp:include&gt;`、`&lt;jsp:directive&gt;`和`&lt;%= %&gt;`等,用于插入Java代码或者调用JavaBean组件。 ### 二、JSP环境配置 在开始学习JSP之前,你需要配置一个Java...

    JSP基础教程(清华版).pdf

    - 包含指令(include directive):包含其他文件 - 标签库指令(taglib directive):引入自定义标签库 5. **JSP动作** - jsp:include:动态包含页面 - jsp:forward:转发请求 - jsp:param:传递参数 - jsp:...

    JSP页面的基本结构——求圆面积周长

    * include动作:&lt;jsp:include page="..." /&gt;,用于将其他JSP页面包含到当前JSP页面中。 五、实验程序及结果 实验程序主要包括两个JSP页面:index.jsp和dealwith.jsp。index.jsp用于实现用户登录界面,而dealwith....

    JSP基础教程(ppt)

    - `jsp:directive.page` 指令用于设置页面属性,如语言、导入的包等。 - `jsp:include` 动作用于动态包含其他文件,提高代码重用。 2. **JSP脚本元素** - `&lt;% %&gt;`:脚本片段,可以包含任何Java代码,通常用于...

    jsp 课程设计 很简单的

    例如,`&lt;jsp:directive.page&gt;`用于设置页面属性,`&lt;%...%&gt;`用于编写Java脚本,`${...}`用于输出Java表达式的值。 2. **JSP生命周期**:JSP页面经过编译、初始化、服务和销毁四个阶段。在编译阶段,JSP被转换为...

    jsp网络编程——源文件(01——05)

    - jsp:include、jsp:forward、jsp:params等动作元素 5. **chap05:JSP与Servlet的交互** - Servlet和JSP的协同工作原理 - Request和Response对象的使用 - Session和Cookie管理 - JSP自定义标签库的开发 **...

Global site tag (gtag.js) - Google Analytics