[英]what is the difference between uri and tagdir in JSP taglib
I am cofused between tagdir
and uri
used in taglib
directive. 我在
taglib
指令中使用的tagdir
和uri
之间tagdir
。 What is the real difference between using tagdir
and uri
? 使用
tagdir
和uri
之间的真正区别是什么?
Examples : 例子 :
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="notMyTags" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="otherTags" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="myTags" %>
to the best of my understanding: 据我所知:
1) I can access non-custom tags from the uri
referencing them by the provided prefix
(eg: if the uri
defines the tag hello
, in the page where taglib-uri
is pasted, I can access it as <notMyTags:hello>
or <otherTags:hello>
). 1)我可以从
uri
通过提供的prefix
引用它们的方式访问非自定义标签(例如:如果uri
定义了标签hello
,则在粘贴taglib-uri
的页面中,我可以将其作为<notMyTags:hello>
或<otherTags:hello>
)。
2) I can access custom tags defined within the path specified in tagdir
referencing them by their .tag
filenames because each custom tag corresponds to a .tag
file (eg: if hello.tag
is a file in the tagDir
specified path, in the page where taglib
is pasted, I can access it as <myTags:hello>
) 2)我可以访问在
tagdir
指定的路径中定义的自定义标签,这些路径由它们的.tag
文件名引用,因为每个自定义标签都对应于一个.tag
文件(例如:如果hello.tag
是tagDir
指定路径中的文件,则在页面中将taglib
粘贴到的地方,我可以作为<myTags:hello>
来访问它)
The two directive are used for two different concepts of custom JSP tags. 这两个伪指令用于定制JSP标记的两个不同概念。
1) You use uri
to reference a tag library , which is usually delivered in a jar and/or defined in a .tld
file. 1)您使用
uri
来引用标签库 ,该标签库通常在jar中提供和/或在.tld
文件中定义。 These can be written in Java (implementing one of the `javax.servlet.jsp.tagext.JspTag' subinterfaces) or as plain JSP tagfiles. 这些可以用Java编写(实现“ javax.servlet.jsp.tagext.JspTag”子接口之一)或作为纯JSP标记文件。
2) You use tagdir
to reference JSP tagfiles within /WEB-INF/tags
(or subdirectories thereof). 2)您可以使用
tagdir
来引用/WEB-INF/tags
(或其子目录)中的JSP /WEB-INF/tags
。 Those can not be Java classes. 那些不能是Java类。
See the J2EE tutorial at Orcale's website for more information regarding JSP tagfiles: http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPTags5.html 有关JSP标记文件的更多信息,请参见Orcale网站上的J2EE教程: http ://docs.oracle.com/javaee/1.4/tutorial/doc/JSPTags5.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.