Fork me on GitHub

Building a tag library for Freemarker, JSP or Velocity

Once you have created a generic tag library, Autotag will automatically generate the corresponding library for Freemarker, JSP, or Velocity. You just create a maven project and include in pom.xml:

  • The appropriate implementation of tiles-request as a dependency. For instance to build a JSP taglib:
  • Your generic tag library as a dependency. For instance:
  • The appropriate configuration of maven-autotag-plugin. For instance:

    No further code is required.

Plugin goals

one or several of the following goals may be used:

generates the files required for a JSP tag library. It can then be included in a JSP using the configured taglibURI.
generates the files required for freemarker user-defined directives. The directives can then be made available to freemarker by adding an instance of the generated class ...FMModelRepository to the freemarker template model.
generates the files required for velocity user directives. The directives can be made available to Velocity by setting the userdirective property, either manually or by using the generated file META-INF/

Plugin configuration

the destination package for the generated classes.
the runtime implementation of TilesRequest to use for freemarker, for instance org.apache.tiles.request.freemarker.autotag.FreemarkerAutotagRuntime.
the runtime implementation of TilesRequest to use for JSP, for instance org.apache.tiles.request.jsp.autotag.JSPAutotagRuntime.
the runtime implementation of TilesRequest to use for velocity, for instance org.apache.tiles.request.velocity.autotag.VelocityAutotagRuntime.
the URI to use for the JSP taglib.