File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

taglib in Web.xml - Just for backward compatibility?

 
Manikandan Jayaraman
Ranch Hand
Posts: 230
  • 0
  • 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?
 
Renu Radhika
Ranch Hand
Posts: 243
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry Renu! I didnt get you.

Can this be explained clearly?
 
rohini gundu
Greenhorn
Posts: 12
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rohini! I got that this time.
 
Renu Radhika
Ranch Hand
Posts: 243
  • 0
  • 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
 
Biba Basnetti
Greenhorn
Posts: 25
  • 0
  • 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.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • 0
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic