• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Package Custom Tag Library In Jar File

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Update: Ive resolved this. Had the tld in wrong place. Should be META-INF not WEB-INF. Working on both Tomcat 6.0 & Glassfish 3.1

Hi

Im trying to package my custom tag library into a jar file and need a bit of help please.

Im using Eclipse and have built a tag class. This works fine in a dynamic web project if I include the .tld file in the WEB-INF folder, and the tag class in src and add taglib entries to the web.xml.

However now I would like to package this up into a jar file to make it easily available to other developers and their projects.

I have tried exporting the class to a jar file and have selected the .tld and web.xml file when exporting - (I assume this bundles all the files into the jar).
But when I add the jar to the build path of another project and copy it into the WEB-INF/lib folder I get the following error:

'PWC6188: The absolute uri: http://swict.malvernhills.gov.uk/taglibs/sw2Tags_Forms cannot be resolved in either web.xml or the jar files deployed with this application'

Please could someone point me in the right direction. Thankyou.

Update - Ive found that if I add the tld and the tag lib entries into the project I can import the jar file and all works ok.
Its just not working when I try to use the tld within the jar file. This is both under glassfish 3.1 and tomcat 6.0

Here is the start of my tld....

<?xml version="1.0" encoding="ISO-8859-1" ?>
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
version="2.1">
<description>SW2 Tag Forms Library</description>
<display-name>SW2 Tag Forms</display-name>
<tlib-version>1.1</tlib-version>
<short-name>sw2</short-name>
<uri>http://swict.malvernhills.gov.uk/taglibs/sw2Tags_Forms</uri>;
<tag>
<name>SW2Tag_Forms</name>
<tag-class>sw2Tags.SW2Tag_Forms</tag-class>
<body-content>empty</body-content>
<attribute>

Here is my web.xml.......

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>sw2Complaints</display-name>
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
<jsp-config>
<taglib>
<taglib-uri>
http://swict.malvernhills.gov.uk/taglibs/sw2Tags_Forms
</taglib-uri>
<taglib-location>
/WEB-INF/sw2Tags_Forms.tld
</taglib-location>
</taglib>
</jsp-config>
</web-app>

Here is the name of my tag handler class....

@SuppressWarnings("serial")
public class SW2Tag_Forms extends BodyTagSupport {

Here is how I call it in a jsp.......

<%@ taglib uri="http://swict.malvernhills.gov.uk/taglibs/sw2Tags_Forms" prefix="sw2Tags"%>
 
Sheriff
Posts: 17734
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rob,

Thanks for updating your post to say that you had already solved it. We really appreciate seeing that kind of initiative and good etiquette around here, especially from a greenhorn, so I tip my hat to you and bid you a warm "Welcome to the Ranch!"

 
Not so fast naughty spawn! I want you to know about
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic