自定义标签

一.jsp2.0以前
1.tld标签描述文件,描述标签名、标签属性、处理类等
2.继承TagSupport或者TagBodySupport,TagBodySupport可以修改标签体的内容。标签有属性时需要提供setter方法。
3.web.xml中配置tld文件的url和路径。如果在tld中配置了<uri>如:<uri>http://java.sun.com/jsp/jstl/core</uri>,就不需要再
web.xml中配置了。
<description>JSTL 1.1 core library</description>
<display-name>JSTL core</display-name>
<tlib-version>1.1</tlib-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jsp/jstl/core</uri>

二.jsp2.0
1.tld标签描述文件,描述标签名、标签属性、处理类等
传统标签不一样的就是<body-content>标签的值是scriptless而不是JSP了
2.继承SimpleTagSupport
JspFragment:代表标签体的对象,它的invoke方法可以控制标签体的输出。不调用invoke方法,不输出标签体内容。
throw new SkipPageException() 控制不输出自定义标签以后的页面内容
3.web.xml中配置tld文件的url和路径。如果在tld中配置 <uri>,就不需要再web.xml中配置了。

三.使用tag file暂时没有研究


一篇详细的介绍地址:http://blog.csdn.net/jiangwei0910410003/article/details/23915373

原文地址:https://www.cnblogs.com/dapeng520/p/4683620.html