• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

TLD files in jar - Mock exam qn

 
Roopa Maheshkumar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • 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.
 
Zaheer A Baloch
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I am planning to take my exam next week. Can someone help me out!!!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right, there's no need to declare it in web.xml.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic