对于 JSP,taglib URI 是否意味着我的站点依赖于 URI 解析?
我正在尝试在我的网站中实现 sitemesh 装饰器。他们网站上的示例有一个完整的 URI,链接到他们的网站,用于装饰器文件的 taglib 部分:
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
这是否意味着我的网站依赖于能够访问该网站?因为我想部署在无法访问外界的内网内。
谢谢
I'm trying to implement a sitemesh decorator in my site. The example on their site has a full URI linking to their site for the taglib part of the decorator file:
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
Does this mean that my site is reliant on being able to access that site? Because i want to deploy inside an intranet which can't access the outside world.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,事实并非如此。
taglib
中声明的 URI 将会在本地解析,只要它与标记库描述符(或web.xml
中)声明的 URI 匹配,具体取决于您的容器的 JSP 版本实现)。有关更多详细信息,请参阅 Java EE 教程。
No, it does not. The URI declared in
taglib
will be resolved locally as long as it matches the URI declared in tag library descriptor (or in yourweb.xml
, depending on what JSP version your container implements).See Java EE tutorial for more details.
不。URI 是通用资源标识符,而不是定位器 (URL)。这意味着 URI 用于唯一标识标签库内部注册表中的每个标签库,就像密钥用于从
HashMap
或Hashtable
设置/获取值一样爪哇。根据 Sun 的 Web 应用程序规范,将 URI 解析为应用程序可以加载/调用的实际标记库按以下顺序进行:
web.xml
文件是否匹配taglib
标签中包含给定的 URI,然后跟随taglib-location
标签实际加载 TLD。META-INF
目录,查找包含指定 URI 的 TLD。No. The URI is a Universal Resource Identifier, it is NOT a locator (URL). This means that the URI is used to uniquely identify each taglib in an internal registry of taglibs, much like a key is used to set/get values from a
HashMap
orHashtable
in Java.According to the web application spec from Sun, resolving the URIs to actual tag libraries that can be loaded/called by the application takes place in the following order:
web.xml
file for matchingtaglib
tags that have the given URI in them and then follow thetaglib-location
tag to actually load the TLD.META-INF
directory of all the JARs in the application for TLDs that contain the URI that was specified.<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" >
其中
uri
属性值解析为容器可以理解的位置,并且prefix
属性告知容器哪些标记位是自定义操作。<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" >
where the
uri
attribute value resolves to a location the container understands and theprefix
attribute informs a container what bits of markup are custom actions.