JSP Tag Library Index
jsp component
Date Revision info
11/29/2005 Initial contribution

The JSP Component provides an index of all available custom tag libraries for use when resolving the URI values in a JSP file's taglib directives. In addition to resolving URI references for tag libraries, it provides a full list of visible tag libraries from a given path, which is intended to be a JSP source file. The primary clients are JSP editors and models, so a greater emphasis has been made to isolate the index's operation from code outside of the JSP component. The most direct result of this is that the index has neither knowledge of nor reliance on WTP's Server Tooling and project structures. The index supports:

  • .tld files within the web application and referenced by filename
  • .jar files within the web application containing a META-INF/taglib.tld, referenced by the .jar's filename
  • .tld files referenced according to their URI value (JSP 1.2) that are within the web application
  • tag libraries referenced according to their TLD's URI value (JSP 1.2) inside of .jar files either in the web application or on the web application's Java Build Path

Support for JSP 2.0's .tag/.tagx files will not be present in WTP 1.0. It is planned in WTP 1.5.


Resolution of taglib URIs begins by calling into the org.eclipse.jst.jsp.core.taglib.TaglibIndex API class. The resolve(String basePath, String reference, boolean crossProjects) method will return an instance of ITaglibRecord which must then be cast down to an appropriate sub-interface for further use.

  • The result ITaglibRecord provides the information necessary to read the custom tag library's descriptor and create a model of its contents. It is not meant to model the contents of the descriptor by itself.
  • Custom tag library descriptors must be within the workspace or within .jar files located on the project's Java Build Path to be indexed. Libraries that are present after deployment but not visible at development time and can not be indexed.
  • The provided base path is meant to represent a JSP source file or a similar path within a web application's content area. The parent of the nearest WEB-INF folder will be treated as the web application's root. A base path outside of the web application root will not resolve records within the web application. A base path inside of one web application will not resolve records within another web application, even if they are located in the same workspace project.

Enumeration of all visible tag libraries begins by calling into the org.eclipse.jst.jsp.core.taglib.TaglibIndex API class. The getAvailableTaglibRecords(IPath fullPath) method will return a collection of visible ITaglibRecords which must then be cast down to appropriate sub-interface for further use.

  • ITaglibRecords will be returned for every method of addressing a visible tag library. If a .jar file contains a META-INF/taglib.tld descriptor that also specifies a uri value for use with JSP 1.2 and newer, records representing both methods of addressing will be returned.
  • The ordering of returned ITaglibRecords is not guaranteed to be consistent between invocations.
  • With server bindings unknown, the index makes no effort to hide results only valid for one JSP specification version when a web application is targetting an earlier version of the JSP specification. It is assumed that server and project structure-aware clients will do so themselves.
API Types
  • org.eclipse.jst.jsp.core.taglib.ITLDRecord
  • org.eclipse.jst.jsp.core.taglib.IJarRecord
  • org.eclipse.jst.jsp.core.taglib.ITaglibRecord
  • org.eclipse.jst.jsp.core.taglib.IURLRecord
  • org.eclipse.jst.jsp.core.taglib.TaglibIndex