如何编写嵌套的JSP标记?

时间:2011-10-11 19:41:52

标签: java-ee jsp-tags

我写了一个jSP标签,就像这样

  <m:OneToOne id="12345" concept="Book">
       <m:Display>
            <m:Attribute name = "Book.BookId" /> 
            <m:Attribute name = "Book.Description" />           
       </m:Display>
    </m:OneToOne>

它的标签tld是:

<taglib xmlns="http://java.sun.com/JSP/TagLibraryDescriptor">
    <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>OneToOneTag</short-name>

    <tag>
        <name>OneToOne</name>
        <tag-class>com.OneToOneTag</tag-class>
        <body-content>tagdependent</body-content>

        <attribute>
            <name>id</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>

        <attribute>
            <name>concept</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
    </tag>

    <tag>
        <name>Display</name>
        <tag-class>com.DisplayTag</tag-class>
        <body-content>tagdependent</body-content>
    </tag>

    <tag>
        <name>Attribute</name>
        <tag-class>com.AttributeTag</tag-class>
        <body-content>empty</body-content>
        <attribute>
            <name>name</name>
            <required>true</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
    </tag>
</taglib>

现在,此代码仅运行OneToOne标记,忽略内部标记。我意识到这是因为身体内容的价值。但我不知道如何解决它?

由于

0 个答案:

没有答案