0

カスタム tld ファイルを作成しました。そして私のjspに含まれています。

myJsp

<%@ taglib uri="/WEB-INF/Tag.tld" prefix="Tag" %>
...
pageContext.setAttribute("pageBean", myPageBean);
pageContext.setAttribute("formBean", myformBean);
...
<Tag:draw pageBean="${pageBean}" Data="${formBean}"/>

my Tag.tld以下のように見えます

<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.0" 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 web-jsptaglibrary_2_0.xsd">
<tlib-version>1.0</tlib-version>
<short-name>ct</short-name>
<uri>/WEB-INF/customTag</uri>
<tag>
    <name>draw</name>
    <tag-class>com.myPackage.calling.someOther.Class</tag-class>
    <body-content>empty</body-content>
    <info>Creates a graph based on the supplied input bean</info>
    <attribute>
        <name>Data</name>
        <required>true</required>
        <description>Provide a form graph bean</description>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <name>pageBean</name>
        <required>true</required>
        <description>Provide a Page Graph bean</description>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
</tag>

ここで、スタック トレースを配置する必要があります。jsp がこの tld ファイルを適切にインポートしているかどうかを知る必要があります。tldファイルからSOPする行が必要ですか???

4

1 に答える 1

1

タグはTLD で宣言および記述されます。TLD には、実行可能なコードは含まれていません。

タグの実装は、TLD: で指定されたクラスにありますcom.myPackage.calling.someOther.Class。必要なすべてのコードをこのクラスに入れます。

于 2012-01-13T09:22:13.267 に答える