Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

taglib-location doubt

 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it necessary for the taglib-location to start with "/" and does the container by default adds /WEB-INF to the location we give.

<taglib>
<taglib-uri>helloWorld</taglib-uri>
<taglib-location>/hello.tld</taglib-location> (or)
<taglib-location>hello.tld</taglib-location>

</taglib>


Thanks
Srividhya
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Srividhya Kiran:
Is it necessary for the taglib-location to start with "/" and does the container by default adds /WEB-INF to the location we give.


As far as i know, you have to start with "/".i think you can put tld in where your jsp is in. so "/" is required.

correct me ,if i am wrong
 
Hema Nandhini
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tld files cannot be in any location. With JSP 2.0, the container automatically checks for tld files inside /WEB-INF or any sub directories inside WEB-INF folder. If its going to be in a jar, it has to be inside /META-INF (/subdirectories). But with JSP versions below 2.0, we have to give an entry for the tld files in the web.xml file as follows:


The taglib location should always start with /WEB-INF or /META-INF in case the tld is to be inside a jar
[ August 04, 2008: Message edited by: Hema Nandhini ]
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Hema Nandhini
 
Srividhya Kiran
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hema

Thanks for your reply. If the container is going to directly look for tld files under WEB-INF then why do we need the location to start with /WEB-INF instead we can start with /hello.tld in my example, so that the container directly looks for hello.tld under WEB-INF directory.

According to your case if we give the location as /WEB-INF/myTag.tld then the container will look for a directory WEB-INF under WEB-INF (which doesnt exist) since the container directly checks under WEB-INF directory for tld files.

Correct me If I am wrong.

Srividhya
 
Hema Nandhini
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srividhya, there are some changes in my answer too!! check this post for better understanding

http://www.coderanch.com/t/171933/java-Web-Component-SCWCD/certification/do-tlds-uris-taglibs

By the way, thanks to you, I too got a better understanding
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic