标签描述文件 tld 内容示例如下:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> <taglib> <tlib-version>2.2.3</tlib-version> <jsp-version>1.2</jsp-version> <short-name>s</short-name> <uri>/struts-tags</uri> <display-name>"Struts Tags"</display-name> <description><![CDATA["To make it easier to access dynamic data; the Apache Struts framework includes a library of custom tags. The tags interact with the framework's validation and internationalization features; to ensure that input is correct and output is localized. The Struts Tags can be used with JSP FreeMarker or Velocity."]]></description> <tag> <name>action</name> <tag-class>org.apache.struts2.views.jsp.ActionTag</tag-class> <body-content>JSP</body-content> <description><![CDATA[Execute an action from within a view]]></description> <attribute> <name>executeResult</name> <required>false</required> <rtexprvalue>false</rtexprvalue> <description><![CDATA[Whether the result of this action (probably a view) should be executed/rendered]]></description> </attribute> <attribute> <name>flush</name> <required>false</required> <rtexprvalue>false</rtexprvalue> <description><![CDATA[Whether the writer should be flush upon end of action component tag, default to true]]></description> </attribute> </tag> </taglib> |
<taglib> 内容 | 描述 |
---|---|
<tlib-version> | 定义标签库的版本 |
<jsp-version> | 定义需要的 JSP 的版本 |
<short-name> | |
<uri> | |
<display-name> | |
<description> | |
<tag> | 定义一个标签,可多个 |
<tag> 内容 | 描述 |
---|---|
<name> | 标签名称 |
<tag-class> | 标签对应的类全名 |
<body-content> | 标签体内容类型, 可为 jsp, empty, tagdependent jsp: 表示标签体内有 <%=val%>
类的代码需要先行解释 |
<description> | 说明 |
<attribute> | 标签的属性,0 个或多个 |
<attribute> 内容 | 描述 |
---|---|
<name> | 属性名 |
<required> | 指定该属性是否必须提供 |
<rtexprvalue> | 指定标签的值是否可以写入 |
<description> | 说明 |