• Post Reply Bookmark Topic Watch Topic
  • New Topic

Confusing Tag-directive

 
madhup narain
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?


 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65667
129
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the URI defined by the TLD is the best approach.
 
Rajeev Rnair
Ranch Hand
Posts: 310
1
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Second one is wrong URI http://abt.com/tld/mytaglib
where as TLD is showing http://abc.com/tld/mytaglib
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2785
175
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!