Problem using JSP/Taglibs with TomCat

H

Huzefa

I am trying to make a simple HelloWorld taglib. I am using Tomcat
5.0.27
and Ant 1.6.1 to compile the project.

The compilation goes fine, and I have created my web.xml and
taglibDemo.tld
file. The package is WAR file and I put this in the webapps directory.

When I try to view the JSP page from my browser, I get the error

C:\jakarta-tomcat-5.0.27\work\Catalina\localhost\taglibDemo-0.1-alpha\org\apache\jsp\index_jsp.java:91:
cannot resolve symbol
symbol : class HelloWorldTag
location: class org.apache.jsp.index_jsp
HelloWorldTag _jspx_th_test_hello_0 = (HelloWorldTag)
_jspx_tagPool_test_hello_nobody.get(HelloWorldTag.class);

It says that it cannot resolve my class HelloWorldTag. The class file
for this tag is in the /WEB-INF/classes directory.

The taglibDemo.tld and web.xml files are very simple and I created
them
from the ones given in the tutorials.

Isn't Tomcat supposed to look for my .class file in the
/WEB-INF/classes
directory? Or am I supposed to explicitly specify the location of my
*.class file?

Any help is much appreciated.

Huzefa
 
C

Chris Smith

Huzefa said:
When I try to view the JSP page from my browser, I get the error

C:\jakarta-tomcat-5.0.27\work\Catalina\localhost\taglibDemo-0.1-alpha\org\apache\jsp\index_jsp.java:91:
cannot resolve symbol
symbol : class HelloWorldTag
location: class org.apache.jsp.index_jsp
HelloWorldTag _jspx_th_test_hello_0 = (HelloWorldTag)
_jspx_tagPool_test_hello_nobody.get(HelloWorldTag.class);

You need to put your tag implementation in a package. In fact, all code
you write should be in a package.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top