jsp自定义标签配置文件 *.tld

配置文件 *.tld 目录位置(不可变):

180341_0Ryr_2351011.png

例子: ql.tld

<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
    version="2.1">
    <!-- 标签的版本 -->
    <tlib-version>1.0</tlib-version>
    <!-- 声明标签的名称 -->
    <short-name>ql</short-name>
    <!-- 声明标签的引用方式标识符号 -->
    <uri>/ql.com</uri>
    <!-- 声明自己的标签 -->
    <tag>
        <!-- 声明标签的名称 -->
        <name>date</name>
        <!-- 声明标签的服务类 -->
        <tag-class>cn.tag.DateTag</tag-class>
        <!-- 声明body的内容是什么 -->
        <body-content>empty</body-content>
    </tag>
    <!-- 添加新的子标签 -->
    <tag>
        <name>myDate2</name>
        <tag-class>cn.tag.Date2Tag</tag-class>
        <body-content>empty</body-content>
        <!-- 声明属性 -->
        <attribute>
            <name>name</name>
            <required>true</required>
            <!-- runtime expression value是否接收运行时间 表达 式的值,即${..} -->
            <rtexprvalue>true</rtexprvalue>
            <type>java.lang.String</type>
        </attribute>
    </tag>

    <tag>
        <name>token</name>
        <tag-class>cn.tag.TokenTag</tag-class>
        <body-content>JSP</body-content>
    </tag>

    <tag>
        <name>for</name>
        <tag-class>cn.tag.ForTag</tag-class>
        <body-content>JSP</body-content>
        <attribute>
            <name>items</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
            <type>java.lang.Object</type>
        </attribute>
        <attribute>
            <name>var</name>
            <required>true</required>
            <rtexprvalue>false</rtexprvalue>
            <type>java.lang.String</type>
        </attribute>
    </tag>
    
    <tag>
        <name>sfor</name>
        <tag-class>cn.tag.STSFor</tag-class>
        <body-content>scriptless</body-content>
        <attribute>
            <name>items</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
            <type>java.lang.Object</type>
        </attribute>
        <attribute>
            <name>var</name>
            <required>true</required>
            <rtexprvalue>false</rtexprvalue>
            <type>java.lang.String</type>
        </attribute>
    </tag>
    
    
    <tag>
        <name>stsfor</name>
        <tag-class>cn.tag.STSForeach</tag-class>
        <body-content>empty</body-content>
        <attribute>
            <name>items</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
            <type>java.lang.Object</type>
        </attribute>
    </tag>
</taglib>
 

 

转载于:https://my.oschina.net/u/2351011/blog/722023

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值