java taglib uri,JSP taglib中uri和tagdir有什么区别

I am cofused between tagdir and uri used in taglib directive.

What is the real difference between using tagdir and uri?

Examples :

to the best of my understanding:

1) I can access non-custom tags from the uri referencing them by the provided prefix (e.g.: if the uri defines the tag hello, in the page where taglib-uri is pasted, I can access it as or ).

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 (e.g.: if hello.tag is a file in the tagDir specified path, in the page where taglib is pasted, I can access it as )

解决方案

The two directive are used for two different concepts of custom JSP tags.

1) You use uri to reference a tag library, which is usually delivered in a jar and/or defined in a .tld file. These can be written in Java (implementing one of the `javax.servlet.jsp.tagext.JspTag' subinterfaces) or as plain JSP tagfiles.

2) You use tagdir to reference JSP tagfiles within /WEB-INF/tags (or subdirectories thereof). Those can not be Java classes.

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值