2007年10月16日火曜日

TLD (タグライブラリディスクリプタ)

TLD ファイルの例

<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.com/xml/ns/jee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
    version="2.0">
    <tlib-version>2.0</tlib-version>
    <short-name>certified</short-name>
    <tag>
        <name>sample</name>
        <tag-class>scwcd.SampleTag</tag-class>
        <body-content>empty</body-content>
    </tag>
</taglib>

____

TLD ファイルの要素
___________________________________________

tlib-version    バージョンを指定
short-name    タグの略称
tag    
    name    タグの名前
    tag-class    タグハンドラクラスの完全修飾名
    body-content    タグのボディに関する定義
                    empty    ボディなし
                            タグでボディを記述するとコンパイルエラー
                    JSP        JSP コードをボディに記述可能
                    tagdependent    タグハンドラクラスに依存
                    scriptless    JSP スクリプトレットの記述不可
    attribute        
        name    属性名
        required    必須属性かどうか(デフォルト false)
        trexprvalue    Runtime Expression Value(JSP の式)
                    を使用できるかどうか(デフォルト false)
        type        データ型
        fragment    属性がフラグメントかどうか(デフォルト false)
    dynamic-attributes 動的属性を有効にするかどうか
                        (デフォルト false)
tag-file    タグファイルの情報を定義
function    関数の定義
___________________________________________

0 件のコメント: