GeeCON Prague 2014*
The moose likes JSP and the fly likes using custom tags & tag handler class - URGENT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "using custom tags & tag handler class - URGENT" Watch "using custom tags & tag handler class - URGENT" New topic
Author

using custom tags & tag handler class - URGENT

Sam Cala
Ranch Hand

Joined: Jan 03, 2001
Posts: 147
Hi guys,
Here is my .tld file :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag
Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.0</jspversion>
<shortname>TAG LIBRARY</shortname>
<tag>
<name>listEvent</name>
<tagclass>
EventHandler
</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>dt</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
AND here is JSP where I'm using this library
<%@ page language="java" session="true" autoFlush="true" import="java.util.*" %>
<%@ taglib prefix="events" uri="/myLibrary" %>
<html>
<body>
<events:listEvent dt="05/29/2002"> hello </events:listEvent>
HELLO
</body>
</html>
I made an entry into web.xml saying :
<taglib>
<taglib-uri>/myLibrary</taglib-uri>

<taglib-location>
/WEB-INF/classes/listEvents.tld
</taglib-location>
</taglib>
Now when I invoking JSP file, its giving me this error :
javax.servlet.ServletException: Parse Error in JSP page: The tag handler class '
EventHandler
' for custom tag 'listEvent' on line '5' could not be found.
I dont know why The tag handler class is not being located. I have put both .tld file and the EventHandler file in the same dir under WEB-INF/classes. ?? Pls. help.
[ May 22, 2002: Message edited by: Sam Cala ]

Best wishes,
Younas Aamir
Greenhorn

Joined: Feb 12, 2002
Posts: 9
Sam
Try with following:
First replace
<tagclass>
EventHandler
</tagclass>
with
<tag-class>
EventHandler
</tag-class>

second create a folder \WEB-INF\classes\test and put
package test;
on top of your EventHandler.java
recompile and replace
<tag-class>
EventHandler
</tag-class>
with
<tag-class>
test.EventHandler
</tag-class>
Hoping this will help you.
Sam Cala
Ranch Hand

Joined: Jan 03, 2001
Posts: 147
I did the same thing and got the following exception :
null
java.lang.NullPointerException
at allaire.jrun.servlet.JRunServletLoader.getClassBytes(JRunServletLoader.java:619)
at allaire.jrun.servlet.JRunServletLoader.loadClass(JRunServletLoader.java:515)
at allaire.jrun.servlet.JRunServletLoader.loadClass(JRunServletLoader.java:444)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at allaire.jrun.servlet.JRunSE.loadClass(JRunSE.java:1367)
at allaire.jrun.jsp.JSPParser.action(JSPParser.java:941)
at allaire.jrun.jsp.JSPParser.parse(JSPParser.java:602)
at allaire.jrun.jsp.JSPParser.writeXML(JSPParser.java:151)
at allaire.jrun.jsp.JSPParser.generateXML(JSPParser.java:123)
at allaire.jrun.jsp.JSPParser.generateXML(JSPParser.java:67)
at allaire.jrun.jsp.JSPServlet.parsePage(JSPServlet.java:409)
at allaire.jrun.jsp.JSPServlet.createServlet(JSPServlet.java:381)
at allaire.jrun.jsp.JSPServlet.loadPage(JSPServlet.java:202)
at allaire.jrun.jsp.JSPServlet.service(JSPServlet.java:169)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1013)
at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:925)
at allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:88)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1131)
at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java:330)
at allaire.jrun.http.WebEndpoint.run(WebEndpoint.java:107)
at allaire.jrun.ThreadPool.run(ThreadPool.java:272)
at allaire.jrun.WorkerThread.run(WorkerThread.java:75)
HELP
Younas Aamir
Greenhorn

Joined: Feb 12, 2002
Posts: 9
Sam
I was supposing that you are using Tomcat. The error shows that you are using JRun, for JRun 3.1 your first setting is quite good. Would you please like to tell me which JRun you are using?
[ May 22, 2002: Message edited by: Younas Aamir ]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Hi,
U have mentioned that u have put .tld file in /WEB-INF/classes directory but I find this
<taglib-location>
/WEB-INF/classes/com/net4india/planner/event/listEvents.tld
</taglib-location>


Groovy
Sam Cala
Ranch Hand

Joined: Jan 03, 2001
Posts: 147
Hi Younas,
I'm using JRun 3.0 Enterprise Edition.
Pradeep, that line has been edited. Both files (.tld & .class are in the same dir)
Sam Cala
Ranch Hand

Joined: Jan 03, 2001
Posts: 147
But if in .tld file, I replace <tag-class> with <tagclass> and run, then it gives me the following error :
javax.servlet.ServletException: Parse Error in JSP page: The tag handler class '
EventHandler
' for custom tag 'listEvent' on line '5' could not be found.
allaire.jrun.jsp.ParseException: The tag handler class '
EventHandler
' for custom tag 'listEvent' on line '5' could not be found.
at allaire.jrun.jsp.JSPParser.action(JSPParser.java:944)
at allaire.jrun.jsp.JSPParser.parse(JSPParser.java:602)
at allaire.jrun.jsp.JSPParser.writeXML(JSPParser.java:151)
at allaire.jrun.jsp.JSPParser.generateXML(JSPParser.java:123)
at allaire.jrun.jsp.JSPParser.generateXML(JSPParser.java:67)
at allaire.jrun.jsp.JSPServlet.parsePage(JSPServlet.java:409)
at allaire.jrun.jsp.JSPServlet.createServlet(JSPServlet.java:381)
at allaire.jrun.jsp.JSPServlet.loadPage(JSPServlet.java:202)
at allaire.jrun.jsp.JSPServlet.service(JSPServlet.java:169)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1013)
at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:925)
at allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:88)
at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1131)
at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java:330)
at allaire.jrun.http.WebEndpoint.run(WebEndpoint.java:107)
at allaire.jrun.ThreadPool.run(ThreadPool.java:272)
at allaire.jrun.WorkerThread.run(WorkerThread.java:75)

Even though EventHandler.class is lying at WEB-INF/classes, than why its not being able to be located ?? Pls. help.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

plz import the class in ur JSP.
Sam Cala
Ranch Hand

Joined: Jan 03, 2001
Posts: 147
Hi Pradeep,
It gives the same error even after i import class file in JSP. Even i have tried to instantiate it using <jsp:useBean/> but its purposeless...
Younas Aamir
Greenhorn

Joined: Feb 12, 2002
Posts: 9
Sam
try to remove this line from your /WEB-INF/classes/listEvents.tld file

<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag
Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
It was bug in JRun 3.0 and was fixed in JRun 3.1
Sam Cala
Ranch Hand

Joined: Jan 03, 2001
Posts: 147
Still there is not any difference...
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Can u paste all ur files here.
Naveen Sydney
Ranch Hand

Joined: Jan 21, 2002
Posts: 30
are u able to run the example that comes with JRun?
 
GeeCON Prague 2014
 
subject: using custom tags & tag handler class - URGENT