• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Confusing Tag-directive

 
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 ?


 
Marshal
Posts: 67446
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the URI defined by the TLD is the best approach.
 
Ranch Hand
Posts: 310
1
Oracle Java Linux
  • 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
 
Creator of Enthuware JWS+ V6
Posts: 3349
303
Android Eclipse IDE Chrome
  • 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
 
Don't touch me. And dont' touch this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic