有关JSP包含指令和JSP包含标签的内容 [英] Something about JSP include directive and JSP include tag
问题描述
在JSP Spec 2.1中,我找到了一个有关JSP include指令和JSP include标签的示例:
In the JSP Spec 2.1, I found an example about the JSP include directive and JSP include tag:
有关一组更复杂的包含的示例,请考虑以下内容 使用四个JSP文件构建的四种情况:A.jsp,C.jsp,dir/B.jsp和dir/C.jsp:
For an example of a more complex set of inclusions, consider the following four situations built using four JSP files: A.jsp, C.jsp, dir/B.jsp and dir/C.jsp :
我不太了解这一点,尤其是第一个和最后一个情况,为什么在第一种情况下C.jsp不能解析为C.jsp?为什么在最后一种情况下c.jsp不能解析为dir/c.jsp?
I don't quite understand this, especially the first and last situation, why the C.jsp are not resolved to C.jsp in the first situation? and why the c.jsp are not resolved to dir/c.jsp in the last situation?
推荐答案
include指令
使用此伪指令来指定资源,该资源包含在翻译时要插入JSP页面的文本或代码.
include directive
Use this directive to specify a resource that contains text or code to be inserted into the JSP page when it is translated.
例如:
<%@ include file="/jsp/userinfopage.jsp" %>
指定资源的相对页面或相对于上下文的路径.
Specify either a page-relative or context-relative path to the resource.
请参见请求JSP页面用于讨论页面相对路径和上下文相对路径.
See Requesting a JSP Page for discussion of page-relative and context-relative paths.
-
include指令(称为静态include)在本质上与本章稍后讨论的
jsp:include
操作具有可比性,但是jsp:include
在请求时而不是转换时生效.请参见静态包含与动态包含 .
The include directive, referred to as a static include, is comparable in nature to the
jsp:include
action discussed later in this chapter, butjsp:include
takes effect at request-time instead of translation-time. See Static Includes Versus Dynamic Includes.
include指令只能在同一servlet上下文(应用程序)中的文件之间使用.
The include directive can be used only between files in the same servlet context (application).
在JSP包含指令中,路径可以相对于包含页面或绝对路径(然后它必须以/
开头,并且属于Web应用程序根目录).
In a JSP include directive the path can be relative to the including page or absolute (then it has to start with a /
and belongs to the web application root directory).
有关更多信息,请参见此处
For more info have a look at another post here
请查看在JSP页面中包含内容
这篇关于有关JSP包含指令和JSP包含标签的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!