aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes taglib in Web.xml - Just for backward compatibility? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "taglib in Web.xml - Just for backward compatibility?" Watch "taglib in Web.xml - Just for backward compatibility?" New topic
Author

taglib in Web.xml - Just for backward compatibility?

Manikandan Jayaraman
Ranch Hand

Joined: Sep 15, 2004
Posts: 230
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?


Regards,<br />Mani<br />SCJP 1.4 (95%)<br />SCWCD 1.4 (94%)
Renu Radhika
Ranch Hand

Joined: Oct 21, 2005
Posts: 243
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

Joined: Sep 15, 2004
Posts: 230
I am sorry Renu! I didnt get you.

Can this be explained clearly?
rohini gundu
Greenhorn

Joined: Nov 16, 2006
Posts: 12
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

Joined: Sep 15, 2004
Posts: 230
Thanks Rohini! I got that this time.
Renu Radhika
Ranch Hand

Joined: Oct 21, 2005
Posts: 243
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

Joined: Oct 09, 2006
Posts: 25
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

Joined: Oct 16, 2005
Posts: 1277
what is the difference between A and C
i got a similar such question in enthuwar mock yesterday

please throw some light on this


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: taglib in Web.xml - Just for backward compatibility?