ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Six Cool New JSP and Servlet Features
Subject:   Writing Tag Files
Date:   2004-02-15 07:14:47
From:   bperry
Response to: Writing Tag Files

Thanks for pointing this out Jerome. The "img" tag is an editorial typo that hasn't been fixed yet. It should look like (minus the opening and closing "< >" so it will display in this message):


img src="${imgDir}${image}" width=
"${width}" height="${height}" align="left"


The imgDir attribute includes the forward slash ("/") to separate the directory location from the image name. This article doesn't show it, but "imgDir" was previous bound as a session attribute, as in: "<% session.setAttribute("imgDir",(request.getContextPath() + "/images/"))
%>"


The "taglib" directive is in the book's example "tag file," from which this article section is derived (recipe 22.11). The book example used the "c:out" element from the JavaServer Pages Standard Tag Library (JSTL) to output the EL statements in the tag file. However, this article uses EL code embedded in the tag file's template text (as you can do with a JSP 2.0 container; see #4 above). Therefore, the taglib directive isn't necessary here (because we're not using the "c:out" element that the taglib directive makes available); it was an oversight in the article. Thanks again!