| 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: 56168
|
|
|
Using the URI defined by the TLD is the best approach.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About 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
Rancher
Joined: Apr 07, 2010
Posts: 1039
|
|
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
|
 |
 |
|
|
subject: Confusing Tag-directive
|
|
|