You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by jl...@gi-bon.sk on 2004/09/06 15:24:53 UTC

Problem when using TAGLIB in JSP

hi.

i have two classes:
"MyClass" and "test.MyClass" (they are totally the same and one of them is 
a member of package "test")

i use them as tagclasses (taglib.tld):
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
        PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
        "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
  <tlibversion>1.1</tlibversion>
  <jspversion>1.1</jspversion>
  <shortname></shortname>
  <tag>
    <name>my_tag</name>
    <tagclass>MyClass</tagclass>  <--- (for the second class it's 
"test.MyClass")
    <bodycontent>JSP</bodycontent>
    <info>
        test  tag
    </info>
    <attribute>
      <name>name</name>
      <required>false</required>
      <rtexprvalue>false</rtexprvalue>
    </attribute>
 </tag>
</taglib>


content of "web.xml":
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 
2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
   <display-name>test_MY</display-name>
        <taglib>
          <taglib-uri>tlt</taglib-uri> 
          <taglib-location>/WEB-INF/taglib.tld</taglib-location> 
        </taglib>
</web-app>


and the "index.jsp" is:
<%@ taglib uri="tlt" prefix="tlt" %>
<html>
        <head>
                <title>Organization</title>
        </head>
        <body bgcolor="white">
        <table border=2 cellspacing=3 cellpadding=3>
                <tr>
                        <td><b>Departments</b></td>
                </tr> 
                <tlt:my_tag>
                <tr>
                        <td><a href="list.jsp?deptName=">aaa</a></td>
                </tr>
                </tlt:my_tag>
        </table>
        </body>
</html>


variant with "test.MyClass" works without problems, but the packageless 
one generates this error/exception:

An error occurred at line: 11 in the jsp file: /index.jsp
Generated servlet error:
C:\Tomcat5\work\Catalina\localhost\test_my\org\apache\jsp\index_jsp.java:91: 
cannot resolve symbol
symbol  : class MyClass 
location: class org.apache.jsp.index_jsp
    MyClass _jspx_th_tlt_my_tag_0 = (MyClass) 
_jspx_tagPool_tlt_my_tag.get(MyClass.class);
    ^


An error occurred at line: 11 in the jsp file: /index.jsp
Generated servlet error:
C:\Tomcat5\work\Catalina\localhost\test_my\org\apache\jsp\index_jsp.java:91: 
cannot resolve symbol
symbol  : class MyClass 
location: class org.apache.jsp.index_jsp
    MyClass _jspx_th_tlt_my_tag_0 = (MyClass) 
_jspx_tagPool_tlt_my_tag.get(MyClass.class);
                                     ^


An error occurred at line: 11 in the jsp file: /index.jsp
Generated servlet error:
C:\Tomcat5\work\Catalina\localhost\test_my\org\apache\jsp\index_jsp.java:91: 
cannot resolve symbol
symbol  : class MyClass 
location: class org.apache.jsp.index_jsp
    MyClass _jspx_th_tlt_my_tag_0 = (MyClass) 
_jspx_tagPool_tlt_my_tag.get(MyClass.class);
 ^
3 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)


my tomcat's version: 5.0.28

i don't know what could be the problem...


any ideas?


Best regards,
Juraj Lonc