aspose file tools*
The moose likes JSP and the fly likes Can't deploy code for taglibs on Tomcat 5.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Can Watch "Can New topic
Author

Can't deploy code for taglibs on Tomcat 5.5

Pratibha Malhotra
Ranch Hand

Joined: Dec 21, 2003
Posts: 199
Hi

I am trying to deploy code that i have lifted from
http://java.sun.com/products/jsp/tutorial/TagLibraries15.html


While doing this I am getting following errors


org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 7 in the jsp file: /main.jsp
Generated servlet error:
DefinitionTag cannot be resolved or is not a type

An error occurred at line: 7 in the jsp file: /main.jsp
Generated servlet error:
DefinitionTag cannot be resolved or is not a type

An error occurred at line: 7 in the jsp file: /main.jsp
Generated servlet error:
DefinitionTag cannot be resolved or is not a type
..............
..............
..............


pls help !!


~ Pratibha Malhotra<br /> <br />Sun Certified Java Programmer<br />SCEA 1.4 (In Progress)<br />~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />"Many of life's failures are people who did not realize how close they were to success when they gave up!!"
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

Without showing us what's on line 7 of main.jsp there's not much to be said.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pratibha Malhotra
Ranch Hand

Joined: Dec 21, 2003
Posts: 199
Line no 7 contains

<tlt efinition name="tutorial" screen="<%= (String)request.getAttribute(\"selectedScreen\") %>">


Below is main.jsp

<%--
% Copyright 2000 Sun Microsystems, Inc. All rights reserved.
% Copyright 2000 Sun Microsystems, Inc. Tous droits r�serv�s.
--%>

<%@ taglib uri="/tlt" prefix="tlt" %>
<tlt efinition name="tutorial" screen="<%= (String)request.getAttribute(\"selectedScreen\") %>">

<tlt:screen id="/home">
<tlt:p arameter name="title" value="Home Page" direct="true"/>
<tlt:p arameter name="banner" value="/banner.jsp" direct="false"/>
<tlt:p arameter name="body" value="/home.jsp" direct="false"/>
</tlt:screen>
<tlt:screen id="/first">
<tlt:p arameter name="title" value="First Page" direct="true"/>
<tlt:p arameter name="banner" value="/banner.jsp" direct="false"/>
<tlt:p arameter name="body" value="/first.jsp" direct="false"/>
</tlt:screen>
<tlt:screen id="/second">
<tlt:p arameter name="title" value="Second Page" direct="true"/>
<tlt:p arameter name="banner" value="/banner.jsp" direct="false"/>
<tlt:p arameter name="body" value="/second.jsp" direct="false"/>
</tlt:screen>
</tlt efinition>
<html>
<head>
<title>
<tlt:insert definition="tutorial" parameter="title"/>
</title>
</head>

<body bgcolor="white">
<tlt:insert definition="tutorial" parameter="banner"/>
<tlt:insert definition="tutorial" parameter="body"/>
</body>
</html>

[ August 09, 2005: Message edited by: Rewa Dev ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

I'd suspect a problem in the TLD definition of the tag.

And, please enclose any posted code in UBB code tags to preserve the formatting, and use the 'disable smilies' checkbox when posting. In fact, I'd strongly encourage you to go back and edit your post to fix these formatting issues if you want people to be able to read your posted code.
Pratibha Malhotra
Ranch Hand

Joined: Dec 21, 2003
Posts: 199
Hi Bear
Thanks for your prompt reply

I know I am askinf a question not relevant to this forum but ..
What is the way to edit my post.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

Clicking the icon that looks like paper and pencil will allow you to edit your post.
Pratibha Malhotra
Ranch Hand

Joined: Dec 21, 2003
Posts: 199
I'd suspect a problem in the TLD definition of the tag.



Below is the taglib file I am using
I am newto taglibs. Might be I am missing out some small mistake.
Kindly have a look at it


<?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.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>aaa</shortname>
<tag>
<name>definition</name>
<tagclass>DefinitionTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>screen</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>screen</name>
<tagclass>ScreenTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>parameter</name>
<tagclass>ParameterTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>direct</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>insert</name>
<tagclass>InsertTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>definition</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>parameter</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
Could you check your server logs to see if you get a more specific error?


http://www.goodercode.com
SCJP 1.4
Pratibha Malhotra
Ranch Hand

Joined: Dec 21, 2003
Posts: 199
Errors in log files are same as what I see in jsp

An error occurred at line: 32 in the jsp file: /main.jsp
Generated servlet error:
InsertTag cannot be resolved or is not a type
..........
..........
An error occurred at line: 33 in the jsp file: /main.jsp
Generated servlet error:
InsertTag cannot be resolved or is not a type

at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke
.........
.........
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

All classes used in a web app should be in a package other than the default. Place your tag handler class in a non-default package.
 
Consider Paul's rocket mass heater.
 
subject: Can't deploy code for taglibs on Tomcat 5.5