You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2004/08/31 11:40:10 UTC
DO NOT REPLY [Bug 30957] New: -
Cannot resolve a custom tag if no package
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30957>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30957
Cannot resolve a custom tag if no package
Summary: Cannot resolve a custom tag if no package
Product: Tomcat 5
Version: 5.0.27
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: Blocker
Priority: Other
Component: Jasper
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: a.goncal@caramail.com
I'm writing a Hello World custom tag. It works perfectely if my tag class is
in a package, but it doesn't if not.
---------------------------------------
Here is the JSP
<%@ taglib uri="/WEB-INF/petstore.tld" prefix="hy" %>
<html>
<body>
<hy:hello/>
</body>
</html>
---------------------------------------
Here is the tag class
import java.io.*;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
public class HelloTag extends SimpleTagSupport {
public void doTag() throws JspException, IOException {
JspWriter out = getJspContext().getOut();
out.println("Hello PetStore !!!");
}
}
---------------------------------------
Here is the tld class
<?xml version="1.0"?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-
jsptaglibrary_2_0.xsd"
version="2.0">
<tlib-version>1.0</tlib-version>
<jsp-version>2.0</jsp-version>
<short-name>Herong's Tag Library</short-name>
<tag>
<name>hello</name>
<tag-class>HelloTag</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>
---------------------------------------
Here is the exception (sorry french browser)
org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP
Une erreur s'est produite à la ligne: 5 dans le fichier jsp: /hello.jsp
Erreur de servlet générée:
D:\Java\jakarta-tomcat-5.0.27
\work\Catalina\localhost\petstore\org\apache\jsp\hello_jsp.java:74: cannot
resolve symbol
symbol : class HelloTag
location: class org.apache.jsp.hello_jsp
HelloTag _jspx_th_hy_hello_0 = new HelloTag();
^
Une erreur s'est produite à la ligne: 5 dans le fichier jsp: /hello.jsp
Erreur de servlet générée:
D:\Java\jakarta-tomcat-5.0.27
\work\Catalina\localhost\petstore\org\apache\jsp\hello_jsp.java:74: cannot
resolve symbol
symbol : class HelloTag
location: class org.apache.jsp.hello_jsp
HelloTag _jspx_th_hy_hello_0 = new HelloTag();
^
2 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError
(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError
(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile
(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
---------------------------------------
Now if you just move the HelloTag class to a package, it works fine
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org