wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Confusing Tag-directive Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Confusing Tag-directive" Watch "Confusing Tag-directive" New topic
Author

Confusing Tag-directive

madhup narain
Ranch Hand

Joined: Dec 14, 2004
Posts: 148
Given -


has been placed in /WEB-INF/mytlds/tld1.tld

is invoked using <mytags:tag1 />

whats is the correct tag directive for this ?

1. <%@ taglib prefix="mytags" uri="/WEB-INF/mytlds/tld1.tld" %>
2. <%@ taglib prefix="mytags" uri="http://abt.com/tld/mytaglib" %>


I always asumed that the uri in the directive MUST match with the uri in the tld, therefore choose 2nd one but seems like its incorrect and the 1st one is correct.
I havent been able to convince my self, can someone help me out ?



Money for nothing and Java for Free
SCJP, SCWCD
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Using the URI defined by the TLD is the best approach.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rajeev Rnair
Ranch Hand

Joined: Mar 22, 2010
Posts: 308

Second one is wrong URI http://abt.com/tld/mytaglib
where as TLD is showing http://abc.com/tld/mytaglib


SCJP6, SCWCD5, OCP-JBCD5, OCE-JWSD6 OCE-JPAD6 , OCM-JEA5 1,OCM-JEA5 2,3 - Brainbench certifications: J2EE, Java2, Java2-NonGUI, JSP, SQL2000 Admin, SQL2000 Programming , Brainbench certified Java Programmer, Computer Programmer, Web Developer, Database Administrator
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1636
    
  23

Hi Madhup,

Both Bear and Rajeev are correct here, but the explanation why

is allowed here is found in the specifications (jsp2.0)
JSP.7.3.6.1 Computing TLD Locations
[removed... just have a look at this part later..]
JSP.7.3.6.3
Finally, the fallback rule allows a taglib directive to refer directly to the TLD.
This arrangement is very convenient for quick development at the expense of less
flexibility and accountability.

Regards,
Frits
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confusing Tag-directive
 
Similar Threads
Taglib Question (enthruware)
the value of <%@taglib uri="" %>?
Tag Library Decriptor Problem
TLD doubt
Extending BodyTagSupport (HFS CH10 Q9)