2010-03-31 42 views
1

我有一個自定義標記,打包到包含在我的web應用程序war文件中的庫jar中。自定義標記'無法解析爲類型'

我得到以下錯誤:

An error occurred at line: 66 in the jsp file: /WEB-INF/jsp/portlet/portfolio/operations/operationsInfo.jsp 
org.apache.jsp.tag.meta.form.WidgetFactory_tag cannot be resolved to a type 
63:  <c:forEach var="fldCfg" items="${config.page.fields}" > 
64:   <tr> 
65:    <td><form:Label fld="${fldCfg}"/></td> 
66:    <td><form:WidgetFactory fld="${fldCfg}" decodesMap="${decodesMap}" command="${operationsInfoBean}" dateFormat="${preferredDateFormat}"/></td> 
67:   </tr> 
68:  </c:forEach> 
69: </table> 

但它似乎並沒有抱怨的標籤是在同一個標​​籤庫。我已經確認jar是在戰爭中,並且標記文件在jar中,並且TLD(在META-INF中)明確定義'WidgetFactory'

爲什麼我得到這個錯誤?

TLD SNIPPIT:

<taglib> 
<tlib-version>1.0</tlib-version> 
<jsp-version>1.2</jsp-version> 
<short-name>Form</short-name> 
<uri>http://web.foo.com/tags/form</uri> 
<description>Tags that encapsulate the Aladdin form elements, both basic and widgets</description> 

<tag-file> 
    <description>Factory to select the correct widget type</description> 
    <name>WidgetFactory</name> 
    <path>/META-INF/tags/form/WidgetFactory.tag</path> 
</tag-file> 

... 

+0

發佈.tld文件的相關部分。 – Pointy 2010-04-02 12:41:57

回答

1

原來,我省略了導入另一個標籤庫被我的標籤使用,所以它不會編譯。

0

確保您在.TLD文件已經得到了類名是正確的。可能是某個地方的軟件包名稱中有拼寫錯誤,或者該類的頭文件可能有錯誤package

+0

這不是一個類,它是一個.tag文件,所以沒有包名稱搞砸了...... – 2010-04-05 13:19:45

+0

啊。那麼,我不確定發生了什麼;對於我來說,你會把1.2的「jsp-version」稱爲「我的知識標記文件是jsp 2.0特性」,這似乎有些奇怪。我不知道這是否會產生任何效果。 – Pointy 2010-04-05 14:27:44

相關問題