aspose file tools*
The moose likes Websphere and the fly likes custom taglib deployment in WebSphere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "custom taglib deployment in WebSphere" Watch "custom taglib deployment in WebSphere" New topic
Author

custom taglib deployment in WebSphere

Mark Clements
Greenhorn

Joined: Feb 15, 2010
Posts: 5
Hi,

I'm having difficulty getting a taglib that I have developed to work as desired in WebSphere 6.1

I have an EAR that contains several WARs; the classloader is set to PARENT_FIRST / SINGLE (so each WAR can see resources defined in the others). One of the WARs contains the jar that defines the taglib, and the jar itself contains the .tld file in META-INF. According to the documentation (J2EE 1.4/JSP/Servlet) this is all that I need to do to make the taglib available to the JSPs in the same WAR. I do not have to modify web.xml or put an external .tld file in WEB-INF or META-INF of the WAR.

When I test the application from RAD 7.5 (this is based on Eclipse 3.4), then JSPs located in another WAR can use the taglibs defined in the jar without any problems. However, when I test using a full WebSphere install, I get the following error:



(the French there means "Unable to locate tag library")

I can only get the second WAR to see the taglib defined in the jar in the first WAR if I either copy the jar into the second WAR, or put the .tld definition from the taglib jar in the second WAR's WEB-INF. Deploying the jar at the EAR level has the same problem.
I want to use this taglib globally and so I don't want to have to either copy it into every WAR deployed or manually maintain a copy of the .tld file in every WAR (we have dozens of WARs).

To recap, the structure I want to be able to use is:

EAR
----WAR1
----------WEB-INF/lib/mytaglib.jar
----WAR2
----------
----------jsp/jspthatusestaglib.jsp
----WAR3
----------
----------jsp/otherjspthatusestaglib.jsp


the structure that I find that I am forced to use either has mytaglib.jar in the WEB-INF/lib of WAR2 and WAR3 or has mytaglib.tld in WEB-INF of WAR2 and WAR3.

In essence my problem is that I seem to be unable to make the taglib in the jar defined in WAR1 available to the other WARs in the EAR. I would like to be able to do this and so am grateful to receive any suggestions. thanks - Mark






Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
I don't think it is possible to have taglibs bundled in one WAR and reference them from another WAR.

What I have seen is following:

1. Declare tag lib element in web.xml


2. Include them in JSP page as following:


But I would be interested in knowing the solution if you are able to achieve what you wanted.
Mark Clements
Greenhorn

Joined: Feb 15, 2010
Posts: 5
OK - that looks like a preferable solution to either copying the jar into each WAR or having an external tld file in each WEB-INF. I can put a reference to the tld in web.xml and let the classloader find it normally. Thanks very much for the suggestion - I'll let you know in the unlikely event that I find a superior solution
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: custom taglib deployment in WebSphere