Meaningless Drivel is fun!*
The moose likes JSP and the fly likes must name be taglib.tld in jarred taglibs + bug Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "must name be taglib.tld in jarred taglibs + bug " Watch "must name be taglib.tld in jarred taglibs + bug " New topic
Author

must name be taglib.tld in jarred taglibs + bug

Kalle Anka
Ranch Hand

Joined: Jul 06, 2005
Posts: 69
Hi,

In my book "SCWCD study kit" by Deshmukh et al it says that:

The JSP specification mandates that, when deployed in a JAR file, a TLD file be placed either directly under or inside a subdirectory of the META-INF directory. In addition, the name of the TLD file must be taglib.tld.

Now when i look at jstl.jar and standard.jar there are alot of *.tld files... but none has the name taglib.tld

Is this wrong? The main problem for me is that i cant these taglibs up and running. I've followed the spec in putting them in WEB-INF/lib and also using implicit mapping in my jsp file:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
Any suggestion?
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
The book you are reading is probably out of date.

The requirement for the file to be called taglib.tld was true in JSP1.1.
As of JSP1.2 multiple taglibs were allowed, so they had to relax the naming restrictions.
Check out the JSP specification section 7.2.1.

>The main problem for me is that i cant these taglibs up and running.
You are trying to get the JSTL tags running?
Do you get any error messages, or does it just not work?

There are a couple of FAQ entries on this:
http://faq.javaranch.com/view?JstlTagLibDefinitions
http://faq.javaranch.com/view?ServletsWebXml

The URI you are using would be correct for JSTL1.1
This requires a JSP2.0 container (eg Tomcat 5).
In order to run correctly, your web.xml file must also declare itself as being version 2.4 (see above FAQ entries).

If you are using something less than Tomcat 5, then you need to get JSTL1.0

If you still have troubles, post back specifying:
- what server (and version) you are using
- what version of JSTL is installed
- what version of java
- any error messages / stack traces


Cheers,
evnafets
Kalle Anka
Ranch Hand

Joined: Jul 06, 2005
Posts: 69
Hi Stefan,

thank you for your elaborate answer. I've worked with getting jstl working for almost two days. Right now im off out town for two days. Then I will look closely at your answer. I think I saw some things right now that I have missed... for instance defining explicitly that its version 2.4 servlet in web.xml which I dont have right now. But anyhow I will reply when I come back in thursday (swedish time) and had have time to test with your suggestions! =) thanx again!

ps: The book im using is brand new... from summer 2005 I think. Its target readers are ppl that want to pass SCWCD 1.4 (JSP 2.0 and Servlet 2.4!) But the authors must have missed that multiple taglibs now are allowed! I'm gonna send them an ERRData to their website.

best wishes
kalle
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

But the authors must have missed that multiple taglibs now are allowed!


Such an egregious error -- multiple versions out-of-date -- would send me looking for a new book.
[ November 08, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kalle Anka
Ranch Hand

Joined: Jul 06, 2005
Posts: 69
Thanx again Stefan,

the problem was that I didnt specifiy version="2.4" explicitly in my deployment descriptor. When I did... I got a syntax error on one of my EL expressions... but when not specified... I swollowed the EL as regular text of course.

I didnt think of explicilty defining what version of Java servlet to use. If you are using JBoss 4.x.x with tomcat 5.x.x you would think that was assumed... I'm trying to get out of my mistakes by blaming Jboss =)

best wishes
Kalle Anka
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

I'm trying to get out of my mistakes by blaming Jboss


Actually, it's Tomcat that has the requirement that you declare the web app as a 2.4 web app before enabling the EL.
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
>Actually, it's Tomcat that has the requirement
To be pedantic about this, Tomcat does it because its a requirement written into the Servlet/JSP Specifications.
Basically its done for backwards compatibility. Any web application that worked on a JSP1.2 container should work unchanged on a JSP2.0 container.

For chapter and verse see JSP Specification section 3.3.2

After reading a couple of comments on amazon about the book you have, I would also be looking for another book.

Cheers,
evnafets
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

To be pedantic about this, Tomcat does it because its a requirement written into the Servlet/JSP Specifications.

True. My point was that it was Tomcat, rather then JBoss, that was the source of the behavior. There was no intention of implying that Tomcat was doing anything incorrectly.
Kalle Anka
Ranch Hand

Joined: Jul 06, 2005
Posts: 69
true... i forgot that Jboss is only an EJB container. But the way many people talk about Jboss (including mysefl) is that jboss is both an EJB and a Servlet container. My appologies =)

I didnt found the book bad. To acheive its goal to pass the SCWCD i found it good. Also for a beginner it was very easy to follow the examples. However the same book in the series that handles SCBCD was terrible. If you want a good book on SCWCD I can also recommend the Head first series that have got even better reviews that the one I used!

best wishes
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: must name be taglib.tld in jarred taglibs + bug