自定义标记'无法解析为类型'

时间:2010-03-31 20:31:13

标签: java jsp taglib

我有一个自定义标记,打包到我的网络应用程序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>

但它似乎没有抱怨Label在同一个taglib中。我已经确认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>

...

2 个答案:

答案 0 :(得分:1)

原来我省略了导入我的标签使用的另一个Tag库,因此无法编译。

答案 1 :(得分:0)

确保.tld文件中的类名是正确的。可能在某个地方的包名中有一个拼写错误,或者该类的标题错误package