當我嘗試在我的webapp中使用自定義taglibs時,它不能在OS X(或Windows)上使用Eclipse和Run Jetty Run運行。當我警告這些文件並在運行apache-tomcat-6.0.20的Linux服務器上運行它們時,沒有任何問題。我在這兩種環境中都使用第三方自定義taglib,沒有問題。custom taglibs cause「PWC6033:Unable to compile class for JSP」
org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP
PWC6197: An error occurred at line: 6 in the jsp file: /temp.jsp
PWC6199: Generated servlet error:
com.test cannot be resolved to a type
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:107)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:280)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:350)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:411)
...
自定義標籤庫TLD看起來像
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>2.0</jsp-version>
<short-name>test</short-name>
<uri>http://test.com/test.tld</uri>
<description>Test</description>
<tag>
<name>custom</name>
<tag-class>com.test.CustomTag</tag-class>
<body-content>empty</body-content>
<description>Custom tag</description>
</tag>
</taglib>
和標籤處理程序
package com.test;
import javax.servlet.jsp.tagext.TagSupport;
public class CustomTag extends TagSupport {
private static final long serialVersionUID = 1L;
}
最後temp.jsp
<%@ taglib uri="http://test.com/test.tld" prefix="test" %>
Hi
<test:custom/>
我覺得我的taglib定義/配置從那以後是正確的整個事情在部署到tomcat的時候起作用,但是我一直在嘗試一些事情來使這個工作在Jetty中無濟於事。
所以在windows現在我已經嘗試運行的應用程序運行碼頭運行,這雖然給出了同樣的問題。 – Tyler 2010-07-10 00:19:33