Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confusing Tag-directive

 
madhup narain
Ranch Hand
Posts: 148
  • 0
  • 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
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • 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: 308
Java Linux Oracle
  • 0
  • 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
Pie
Posts: 2167
57
Android Chrome Eclipse IDE
  • 0
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic