This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
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

from HF page 437, Writing TLD file

 
Vishnu Munnangi
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I wanted to use <c:forEach> tag from JSTL to iterate over arrays and collection.

From HF Page 437, In the JSP code, they used taglib directive, but did not write a TLD file .

Can anyone explain me how to write a TLD file for sample example given in Page 436 of HF.

Thanks in Advance.
 
Paul Croarkin
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do not need to write a TLD for the JSTL. JSTL is a tag library that has already been written; it comes with a TLD. You only need to write a TLD if you are creating your own custom tags.
 
Vishnu Munnangi
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Paul,

So I did not write a TLD file since I am not creating a custom tag. I wrote the same Jsp Code as given in the HF book Page 437 and wrote a servlet and a web.xml file and deployed all of them in Web app. As told in the begining of the chapter I copied "jstl.jar" file from WEB-INF/lib directory, and pasted it in my WEB-INF/lib directory,

when I am typing the url http:\\localhost:8080\Example1\music.do in the browser
I am getting an error: " org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application"

Can any one explain how to solve this problem
Thanks in advance.
 
Vishnu Munnangi
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I just happened to see this link
http://www.oreilly.com/catalog/headservletsjsp/errata/headservletsjsp.confirmed
This link gives the errors from HF book. In page 434 Intalling JSTL1.1, we need to copy the "jstl.jar" file and also need "standard.jar" file from the webapps/jsp-examples/WEB-INF/lib/ directory.
 
Paul Croarkin
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the TLD will be packaged in the jstl.jar. If you are running in a JSP 2.0 container, as long as you have the jar in the correct place and reference the correct uri (should match the uri in the TLD) in your JSP, everything should work. If your container is not JSP 2.0 compliant, you will need to make a <taglib> entry in the web.xml.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic