• 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

taglib in Web.xml - Just for backward compatibility?

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
Thanks Rohini! I got that this time.
 
Renu Radhika
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic