对于 JSP,taglib URI 是否意味着我的站点依赖于 URI 解析?

发布于 2024-08-12 05:06:28 字数 258 浏览 9 评论 0原文

我正在尝试在我的网站中实现 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

旧伤慢歌 2024-08-19 05:06:28

不,事实并非如此。 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 your web.xml, depending on what JSP version your container implements).

See Java EE tutorial for more details.

ˇ宁静的妩媚 2024-08-19 05:06:28

不。URI 是通用资源标识符,而不是定位器 (URL)。这意味着 URI 用于唯一标识标签库内部注册表中的每个标签库,就像密钥用于从 HashMapHashtable 设置/获取值一样爪哇。

根据 Sun 的 Web 应用程序规范,将 URI 解析为应用程序可以加载/调用的实际标记库按以下顺序进行:

  1. 检查 web.xml 文件是否匹配 taglib 标签中包含给定的 URI,然后跟随 taglib-location 标签实际加载 TLD。
  2. 如果未找到与 #1 匹配的内容,请递归检查应用程序中所有 JAR 的 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 or Hashtable 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:

  1. Check the web.xml file for matching taglib tags that have the given URI in them and then follow the taglib-location tag to actually load the TLD.
  2. If no match with #1 was found, recursively check the META-INF directory of all the JARs in the application for TLDs that contain the URI that was specified.
红尘作伴 2024-08-19 05:06:28

<%@ 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 the prefix attribute informs a container what bits of markup are custom actions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文