• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL - Configuration.

 
Manikandan Jayaraman
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have been reading Tag Libraries for the past 2 weeks and read about defining custom tags. I have been trying to implement a sample sutom tag, given in the book but not being able to.

I would like to know, where to place the tld file, where to place the tag handler class. I always get the error "resource not found" and Tomcat reports me that, it is not able to locate my Tag Handler class.

Please advice.
-Mani
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You class files go under WEB-INF/classes just like any other classes.

The TLD file can go anywhere as long the taglib directive on your JSP points to it. I put mine under WEB-INF/tlds

<%@ taglib uri="/WEB-INF/tlds/my-taglib.tld" prefix="myPrefix" %>
 
Manikandan Jayaraman
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Ben! The way you have told is the way i have done. But still I experience problems

Explaining my way here ... Pls Help!

====================
conf/Server.xml
====================
<Context path="/Mani" docBase="/Mani/WEB-INF/jsp" debug="1" reloadable="true"/>
====================

====================
In webapps\Mani\WEB-INF\
====================
Mani_Taglib.tld
jsp/ - Folder having SimplePrimeTag.jsp
classes/taghandlers - SimplePrimeTag.class
=====================

Important lines in diff. files
==============================
Mani_Taglib.tld
===============
<tag>
...
<tagclass>taghandlers.SimplePrimeTag</tagclass>
...
</tag>
================
SimplePrimeTag.jsp
================
...
<%@ taglib uri="..\Mani_Taglib.tld" prefix="prime" %>
<prime:simplePrime />
=================


The Taghandler compiles fine and class file in classes\taghandlers\.

What is wrong here?

The error displays:
===================

org.apache.jasper.JasperException: /SimplePrimeTag.jsp(13,0) Unable to load tag handler class "taghandlers.SimplePrimeTag" for tag "prime:simplePrime"


Thanks!
Mani
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!