jsp自定義標籤、函數的tld文件格式筆記

編程語言 JSP XML Java 學習編程 2017-05-20

<?xml version="1.0" encoding="UTF-8"?>

<taglib xmlns="http://java.sun.com/xml/ns/j2ee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"

version="2.0">

<!-- 標籤庫的版本 -->

<tlib-version>1.0</tlib-version>

<!-- 標籤庫的名稱 -->

<short-name>SimpleTagLibrary</short-name>

<!-- 自定義uri -->

<uri>http://tomcat.apache.org/jsp2-example-taglib</uri>

<!-- 註冊函數 -->

<function>

<!-- 函數名 -->

<name>reverse</name>

<!-- 函數的類 -->

<function-class>jsp2.examples.el.Functions</function-class>

<!-- 方法 -->

<function-signature>java.lang.String reverse( java.lang.String )</function-signature>

</function>

<!-- 註冊標籤 -->

<tag>

<!-- 標籤名 -->

<name>helloWorld</name>

<!-- 標籤的類 -->

<tag-class>jsp2.examples.simpletag.HelloWorldSimpleTag</tag-class>

<!-- 標籤是否有標籤體

empty: 沒有

scriptless: 有標籤體,但不能出項java腳本,但可以出項el表達式

tagdependent: (已過時)有標籤體,原樣傳給標籤處理類

-->

<body-content>empty</body-content>

<!-- 註冊標籤屬性 -->

<attribute>

<!-- 屬性名 -->

<name>name</name>

<!-- 此屬性是否是必須的 -->

<required>true</required>

<!-- 是否支持el表達式 -->

<rtexprvalue>true</rtexprvalue>

</attribute>

</tag>

</taglib>

相關推薦

推薦中...