• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

JWebPlus -Question ID :998318336796

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following are properly formatted taglib elements occuring in web.xml?

1.
<taglib>
<taglib-uri>/binomial</taglib-uri>
<taglib-location>/WEB-INF/MathLib.tld</taglib-location>
</taglib>
2.
<taglib>
<taglib-uri>/binomial</taglib-uri>
<taglib-location>/WEB-INF/MathLib.jar</taglib-location>
</taglib>
3.
<taglib id="ABC_MATH_LIB">
<taglib-uri>/binomial</taglib-uri>
<taglib-location>/WEB-INF/MathLib.tld</taglib-location>
</taglib>
4.
<taglib name="ABC_MATH_LIB">
<taglib-uri>/binomial</taglib-uri>
<taglib-location>/WEB-INF/MathLib.jar</taglib-location>
</taglib>
5.
<taglib author="ABCINC">
<taglib-uri>/binomial</taglib-uri>
<taglib-location>/WEB-INF/MathLib.tld</taglib-location>
</taglib>

Answer is given as 1 and 3. Why not 2 is correct?

Sam
[ February 04, 2003: Message edited by: Mathew Sam ]
 
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, bit of a guess here, but it may have something to do with the fact that a jar'd .tld file must be bundled under the WEB-INF/lib directory
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi mark,
I think you're right. More information can be found : http://www.onjava.com/pub/a/onjava/2001/03/15/tomcat.html
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
the <taglib-location> should be this according to the servelt specification for the web.xml file
"the taglib-location element contains the location (as a resource
relative to the root of the web application) where to find the Tag
Libary Description file for the tag library."
a jar file is not a Tag Libary Description file.
so answer 2 is wrong!
Hope that helps!
/Enrico
 
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have jar file in taglib-location tag.
Belos is a valid declaration:

some_taglib.jar should be deployed in WEB-INF/lib folder.
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answer 2 is incorrect because the JAR file is not in the correct location.
JSP 2.0:
JSP.7.2.1 Packaged Tag Libraries
JSP page authoring tools and JSP containers are required to accept a tag library that is packaged as a JAR file. When deployed in a JSP container, the standard JAR conventions described in the Servlet 2.4 specification apply, including the conventions for dependencies on extensions.
I didn't have servlet 2.4 handy, but I do have servlet 2.3:
SRV.9.5 Directory Structure
A web application exists as a structured hierarchy of directories. The root of this hierarchy serves as the document root for files that are part of the application.
.....
A special directory exists within the application hierarchy named �WEB-INF�. This directory contains all things related to the application that aren�t in the document root of the application.
.....
The contents of the WEB-INF directory are:
� The /WEB-INF/lib/*.jar area for Java ARchive files.
[ February 07, 2003: Message edited by: Kevin Mukhar ]
 
Just the other day, I was thinking ... about this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!