FAQ: 是否可以设置JSP taglib的uri属性到一个远程的TLD文件

文章编号 : 28807
软件: ArcGIS Server 9.0, 9.0.1, 9.1, 9.2, 9.3, 9.3.1 ArcIMS 4.0, 4.0.1, 9.0, 9.0.1, 9.1, 9.2, 9.3, 9.3.1
操作系统: N/A
已邀请:

EsriSupport

赞同来自:

问题:
是否可以设置JSP taglib的uri属性到一个远程的TLD文件?
回答:
简而言之,答案是“否”。 Uri属性可以: 1) 指定到磁盘路径 2) 或通过web.xml 文件映射到某个磁盘路径 在web.xml 文件中, taglib包含两个子元素: taglib-uri 和 taglib-location。它们定义了JSP taglib uri参数和tld文件磁盘路径的唯一的字符串。这里有J2EE JSP 部署描述文件的一部分: <xsd:complexType name="taglibType">
- <xsd:annotation>
<xsd:documentation>The taglibType defines the syntax for declaring in the deployment descriptor
that a tag library is available to the application. This can be done to override implicit map
entries from TLD files and from the container.</xsd:documentation>
</xsd:annotation>
- <xsd:sequence>
- <xsd:element name="taglib-uri" type="j2ee:string">
- <xsd:annotation>
<xsd:documentation>A taglib-uri element describes a URI identifying a tag library used in the web
application. The body of the taglib-uri element may be either an absolute URI specification, or a
relative URI. There should be no entries in web.xml with the same taglib-uri
value.</xsd:documentation>
</xsd:annotation>
</xsd:element>
- <xsd:element name="taglib-location" type="j2ee:pathType">
- <xsd:annotation>
<xsd:documentation>the taglib-location element contains the location (as a resource relative to
the root of the web application) where to find the Tag Library Description file for the tag
library.</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID" />
</xsd:complexType>
J2EE定义的所有xsd可以从以下的网址访问到: J2EE Specifications
这里有一个JSP的tablib示例:

<%@ taglib uri="http://www.esri.com/argcis/webcontrols" prefix="ags" %>
这个uri看起来对应了一个远程的资源,但实际上在web应用的web.xml文件中显示了这个uri映射到了一个本地文件上:

<taglib>
<taglib-uri>http://www.esri.com/argcis/web ... gt%3B
<taglib-location>/WEB-INF/arcgis_webcontrols.tld</taglib-location>
</taglib>
其实,也可以不在web.xml中对TLD进行映射,Java Web容器(如Tomca)会从JAR包的META-INF目录中读取TLD文件,这个TLD文件中可以保存相关的信息:

<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>a</short-name>
<uri>http://www.esri.com/arcgis/webcontrols</uri>
...
</taglib>




创建时间:2005-03-11
最近更新: 2010-06-18


原文链接
http://support.esrichina.com.cn/2005/0311/923.html

要回复问题请先登录注册