Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't deploy code for taglibs on Tomcat 5.5

 
Pratibha Malhotra
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65116
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without showing us what's on line 7 of main.jsp there's not much to be said.
 
Pratibha Malhotra
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65116
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65116
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Clicking the icon that looks like paper and pencil will allow you to edit your post.
 
Pratibha Malhotra
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you check your server logs to see if you get a more specific error?
 
Pratibha Malhotra
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65116
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic