This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with running Classic tags

 
Senthil Kumar
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have written a classic tag handler (to be honest copied) and tried to invoke that in jsp.but this is what i'm getting

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

An error occurred at line: 8 in the jsp file: /customtag1.jsp
Generated servlet error:
classic1 cannot be resolved to a type

An error occurred at line: 8 in the jsp file: /customtag1.jsp
Generated servlet error:
classic1 cannot be resolved to a type

An error occurred at line: 8 in the jsp file: /customtag1.jsp
Generated servlet error:
classic1 cannot be resolved to a type


Here is my jsp:
<%@ taglib prefix="ss" uri="/WEB-INF/mytld.tld" %>
<html>
<head>
</head>
<body>
<ss:sstag>
<%
out.println(" hai inside the jsp...");
%>
</ss:sstag>
</body>
</html>

and my tld is
<?xml version="1.0" encoding="UTF-8"?>
<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>

<tag>
<name>sstag</name>
<tagclass>classic1</tagclass>
<body-content>JSP </body-content>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>

</taglib>

and the tag class is compiled and placed in WEB-INF/classes.
where am i getting it wrong?
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your tld file is incomplete check tld below and see where you have made mistakes.
 
Senthil Kumar
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dude,
i have changed the tagclass into tag-class and put the uri tag(this not mandatory as a matter of fact).but still i'm getting the same exception.
 
KRK Gowda
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to package your classic tag handler and change value for <tag-class>.
Ex :<tag-class>tags.Classic1</tag-class> if Classic1.java is present in WEB-INF/classes/tags folder.
 
KRK Gowda
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Value of <uri> tag should match with attribute uri of taglib directive.
 
Senthil Kumar
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no it resides in the the dafault package.And i tried the uri thing.And also <taglib> specification in DD.both are giveing the same exception
 
Boobalan Pillai
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Whenever you work with TagHandler follow the packaging convention.put your class under anyone package like tags.Classic1.java...then use page directive to import this class.

<%@ page import="tags.Classic1" %>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic