• 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

taglib in Web.xml - Just for backward compatibility?

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

Question from JDiscuss ...



Options:

A. 1
B. 2
C. 3
D. There is no need for a <taglib> element in web.xml, as the library will be downloaded from http://abc.com/graphs/graphlib.jar
E. None of these

==============

Do we require taglib in web.xml at all? I thought that if the jar file is placed in web-inf/lib, that would suffice. Thus I answered "E. None of these".

However test said 'C'

Can someone explain?
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no in that case the uri mentioned in taglib directive should be that or your tld should have the url you have used in your jsp for the uri tag
 
Manikandan Jayaraman
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry Renu! I didnt get you.

Can this be explained clearly?
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suppose that in the jsp file you have the following taglib directive
<%@ taglib uri="WEB-INF/lib/SimpleTagDemo.jar" prefix="h" %>
i.e., if the path in uri points to the jar file as in the above line, then there is no need for mentioning it in the web.xml.
But in the question in the taglib directive uri path is not the path where the jar file is placed. So you need to mention it in the web.xml.
Hope i am clear.
 
Manikandan Jayaraman
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Rohini! I got that this time.
 
Renu Radhika
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No then what if the uri in the taglib directive is same as that in the URI of TLD.I guess in that case also we dont need the web.xml entry
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The correct answer is C because the mapping of

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

maps to

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


i.e., if the path in uri points to the jar file as in the above line, then there is no need for mentioning it in the web.xml



The taglib uri has nothing to do with path or location. The uri is just a unique name to help the container map a taglib directive to a tld file.
 
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the difference between A and C
i got a similar such question in enthuwar mock yesterday

please throw some light on this
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic