• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

TLD files in jar - Mock exam qn

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The source for this qn is enthuware.

Qn :- You have a JSP page that contains the following taglib directive for accessing tags of a tag library developed by ABC, Inc.:

<%@ taglib prefix="test" uri="http://abc.com/graphs/graphlib.jar">;

Further, the tag library is shipped to you in the form of a jar file named graphlib.jar.

You've kept this jar file in WEB-INF/lib directory of your web application.

Which of the following lines will you add in the deployment descriptor so that your jsp page can access the tags of the library?

1) <taglib>
<taglib-uri>http://abc.com/graphs/graphlib.jar</taglib-uri>;
</taglib>

2)<taglib>
<taglib-uri>http://abc.com/graphs/graphlib.jar</taglib-uri>;
<taglib-location>/lib/graphlib.jar</taglib-location>
</taglib>

3)There is no need for a <taglib> element in web.xml, as the library will be downloaded from http://abc.com/graphs/graphlib.jar

4)None of these

5)<taglib>
<taglib-uri>http://abc.com/graphs/graphlib.jar</taglib-uri>;
<taglib-location>lib/graphlib.jar</taglib-location>
</taglib>

Answer is 5. But my guess was 4) as there is no need to declare in web.xml for JSP 2.0.

Please help me in understanding.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is what i think, the TLD location does not need to be specified in the web.xml if the TLD is cotained in META-INF folder or its subdirectories in the JAR file. The question is unclear about the fact that whether the TLD is contained in META-INF folder or root of the JAR file. If its in the root I think we need to specify the location in web.xml.

I am also not sure for the case when TLD is in JAR root folder and not in META-INF folder.

Help!!!

 
Roopa Maheshkumar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am planning to take my exam next week. Can someone help me out!!!
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right, there's no need to declare it in web.xml.
 
Bring me the box labeled "thinking cap" ... and then read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic