freemarker.ext.jsp

Class TaglibFactory

Implemented Interfaces:
TemplateHashModel, TemplateModel

public class TaglibFactory
extends java.lang.Object
implements TemplateHashModel

A hash model associated with a servlet context that can load JSP tag libraries associated with that servlet context. An instance of this class is made available in the root data model of templates executed by FreemarkerServlet under key JspTaglibs. It can be added to custom servlets as well to enable JSP taglib integration in them as well.
Version:
$Id: TaglibFactory.java,v 1.26.2.1 2007/05/16 12:13:04 szegedia Exp $
Author:
Attila Szegedi

Fields inherited from interface freemarker.template.TemplateModel

NOTHING

Constructor Summary

TaglibFactory(ServletContext ctx)
Creates a new JSP taglib factory that will be used to load JSP taglibs for the web application represented by the passed servlet context.

Method Summary

TemplateModel
get(String uri)
Retrieves a JSP tag library identified by an URI.
boolean
isEmpty()
Returns false.

Constructor Details

TaglibFactory

public TaglibFactory(ServletContext ctx)
Creates a new JSP taglib factory that will be used to load JSP taglibs for the web application represented by the passed servlet context.
Parameters:
ctx - the servlet context whose JSP tag libraries will this factory load.

Method Details

get

public TemplateModel get(String uri)
            throws TemplateModelException
Retrieves a JSP tag library identified by an URI. The matching of the URI to a JSP taglib is done as described in the JSP 1.2 FCS specification.
Specified by:
get in interface TemplateHashModel
Parameters:
uri - the URI that describes the JSP taglib. It can be any of the three forms allowed by the JSP specification: absolute URI, root relative URI and non-root relative URI. Note that if a non-root relative URI is used it is resolved relative to the URL of the current request. In this case, the current request is obtained by looking up a HttpRequestHashModel object named Request in the root data model. FreemarkerServlet provides this object under the expected name, and custom servlets that want to integrate JSP taglib support should do the same.
Returns:
a hash model representing the JSP taglib. Each element of this hash model represents a single custom tag from the library, implemented as a TemplateTransformModel.

isEmpty

public boolean isEmpty()
Returns false.
Specified by:
isEmpty in interface TemplateHashModel