0

我有一个引用标签库 sm.tld 的 jsp 文件。

浏览器说:

scripts.jsp:1:5: No tag library could be found with this URI. Possible causes could be that the URI is incorrect, or that there were errors during parsing of the .tld file. <%@ taglib uri="/WEB-INF/classes/sm.tld" prefix="sm" %>

这是 sm.tld:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"   "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib> 
<tlibversion>1.0</tlibversion>
<jspversion>2.0</jspversion>
<shortname>sm</shortname>
<uri></uri>
<tag>
    <name>topcategories</name>
    <tag-class>com.salesmanager.core.util.www.tags.TopCategoriesTag</tag-class>
    <body-content>scriptless</body-content>
    <attribute>
        <name>merchantId</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
        <type>int</type>
    </attribute>
    <attribute>
        <name>maxCategories</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
        <type>int</type>
    </attribute>
    <attribute>
        <name>lineBreakQuantity</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
        <type>int</type>
    </attribute>    
</tag>
<!-- Product Tag -->
<tag>
    <name>productimage</name>
    <tag-class>com.salesmanager.core.util.www.tags.ProductImageTag</tag-class>
    <body-content>scriptless</body-content>
    <attribute>
        <name>product</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
        <type>com.salesmanager.core.entity.catalog.Product</type>
    </attribute>
    <attribute>
        <name>source</name>
        <required>true</required>
        <rtexprvalue>false</rtexprvalue>
        <type>String</type>
    </attribute>
    <attribute>
        <name>resizeratio</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
        <type>int</type>
    </attribute>
    <attribute>
        <name>id</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
        <type>String</type>
    </attribute>
    <attribute>
        <name>cssClass</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
        <type>String</type>
    </attribute>
    <attribute>
        <name>addSchemeHostAndPort</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
        <type>boolean</type>
    </attribute>            
</tag>
<tag>
    <name>productprice</name>
    <tag-class>com.salesmanager.core.util.www.tags.ProductPriceTag</tag-class>
    <body-content>scriptless</body-content>
    <attribute>
        <name>product</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
        <type>com.salesmanager.core.entity.catalog.Product</type>
    </attribute>
    <attribute>
        <name>displayCurrency</name>
        <required>true</required>
        <rtexprvalue>false</rtexprvalue>
        <type>Boolean</type>
    </attribute>
</tag>
<tag>
    <name>productpricespecial</name>
    <tag-class>com.salesmanager.core.util.www.tags.ProductPriceSpecialTag</tag-class>
    <body-content>scriptless</body-content>
    <attribute>
        <name>product</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
        <type>com.salesmanager.core.entity.catalog.Product</type>
    </attribute>
    <attribute>
        <name>displayCurrency</name>
        <required>true</required>
        <rtexprvalue>false</rtexprvalue>
        <type>Boolean</type>
    </attribute>
</tag>
<tag>
    <name>productpricefinal</name>
    <tag-class>com.salesmanager.core.util.www.tags.ProductPriceFinalTag</tag-class>
    <body-content>scriptless</body-content>
    <attribute>
        <name>product</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
        <type>com.salesmanager.core.entity.catalog.Product</type>
    </attribute>
    <attribute>
        <name>displayCurrency</name>
        <required>true</required>
        <rtexprvalue>false</rtexprvalue>
        <type>Boolean</type>
    </attribute>
</tag>
<tag>
    <name>pageslinks</name>
    <tag-class>com.salesmanager.core.util.www.tags.PagesLinksTag</tag-class>
    <body-content>scriptless</body-content>
    <attribute>
        <name>merchantId</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
        <type>int</type>
    </attribute>
    <attribute>
        <name>lineBreakQuantity</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
        <type>int</type>
    </attribute>    
</tag>
<tag>
    <name>languages</name>
    <tag-class>com.salesmanager.core.util.www.tags.LanguagesTag</tag-class>
    <body-content>scriptless</body-content>
    <attribute>
        <name>delimiter</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
        <type>String</type>
    </attribute>
</tag>
<tag>
        <name>param</name>
        <tagclass>com.salesmanager.core.util.www.tags.ParameterTag</tagclass>
        <bodycontent>JSP</bodycontent>
        <info>
            Set url parameter
        </info>
        <attribute>
            <name>name</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>value</name>
        <required>false</required>
        <rtexprvalue>true</rtexprvalue>
        </attribute>
</tag>
<tag>
        <name>url</name>
        <tagclass>com.salesmanager.core.util.www.tags.UrlTag</tagclass>
        <bodycontent>JSP</bodycontent>
        <info>Url builds an encoded URL. (Inherit struts 2 url tag)</info>
        <attribute>
            <name>value</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>scheme</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>id</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>includeParams</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>includeContext</name>
            <required>false</required>
            <rtexprvalue>false</rtexprvalue>
        </attribute>
        <attribute>
            <name>encode</name>
            <required>false</required>
            <rtexprvalue>false</rtexprvalue>
        </attribute>
        <attribute>
            <name>action</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
            <name>namespace</name>
            <required>false</required>
            <rtexprvalue>true</rtexprvalue>
        </attribute>
        <attribute>
        <name>forceAddSchemeHostAndPort</name>
        <required>false</required>
        <rtexprvalue>false</rtexprvalue>
        </attribute>
</tag>
<tag>
    <name>contents</name>
    <tagclass>com.salesmanager.core.util.www.tags.ContentsTag</tagclass>
    <bodycontent>empty</bodycontent>
    <attribute>
        <name>merchantId</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <name>sectionId</name>
        <required>true</required>
    </attribute>
</tag>
<tag>
    <name>content</name>
    <tagclass>com.salesmanager.core.util.www.tags.ContentTag</tagclass>
    <bodycontent>empty</bodycontent>
    <attribute>
        <name>merchantId</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <name>title</name>
        <required>true</required>
    </attribute>
</tag>
<tag>
    <name>downloadUrl</name>
    <tagclass>com.salesmanager.core.util.www.tags.OrderProductDownloadTag</tagclass>
    <bodycontent>empty</bodycontent>
    <attribute>
    <name>productDownload</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
</tag>
</taglib>

请帮我找出错误?

4

1 回答 1

0

你需要在<uri></uri>这里指定一个有效的,<uri>myFunctions</uri>这样你就可以在你的 JSP 中使用自定义标签:

<%@ taglib prefix="tt" uri="myFunctions" %>

在此处浏览官方教程。

或者,您可以使用以下tagdir属性:

<%@ taglib tagdir="/WEB-INF/classes/sm.tld" prefix="sm" %> 
于 2013-05-29T17:03:45.737 回答