aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes JWebPlus -Question ID :998318336796  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "JWebPlus -Question ID :998318336796  " Watch "JWebPlus -Question ID :998318336796  " New topic
Author

JWebPlus -Question ID :998318336796

Mathew Sam
Ranch Hand

Joined: Dec 19, 2001
Posts: 124
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 ]
Mark Howard
Ranch Hand

Joined: Feb 14, 2001
Posts: 285
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
Engin Okucu
Ranch Hand

Joined: Feb 09, 2002
Posts: 174
Hi mark,
I think you're right. More information can be found : http://www.onjava.com/pub/a/onjava/2001/03/15/tomcat.html
Enrico Mannarino
Ranch Hand

Joined: Dec 14, 2001
Posts: 133
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
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
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.
Kevin Mukhar
Ranch Hand

Joined: Nov 28, 2000
Posts: 83
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JWebPlus -Question ID :998318336796