当我尝试在我的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