| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <html> |
| <head> |
| <title>Apache Velocity Tools - Usage</title> |
| <style type="text/css" media="all"> |
| @import url("./css/maven-base.css"); |
| @import url("./css/maven-theme.css"); |
| @import url("./css/site.css"); |
| </style> |
| <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" /> |
| <link rel="alternate" href="http://feeds.feedburner.com/ApacheVelocitySiteNews" type="application/rss+xml" title="Apache Velocity Tools - Usage News" /> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| </head> |
| <body class="composite"> |
| <div id="banner"> |
| <a href="../../../" id="bannerLeft"> |
| |
| <img src="images/velocity_project_wide.png" alt="" /> |
| |
| </a> |
| <span id="bannerRight"> |
| |
| <img src="images/velocitytools.png" alt="" /> |
| |
| </span> |
| <div class="clear"> |
| <hr/> |
| </div> |
| </div> |
| <div id="breadcrumbs"> |
| |
| |
| |
| |
| |
| |
| |
| |
| <div class="xleft"> |
| |
| <a href="http://www.apache.org/">Apache</a> |
| > |
| |
| <a href="../../../">Velocity</a> |
| > |
| |
| <a href="../">Velocity Tools</a> |
| > |
| |
| <a href="../../../">Velocity</a> |
| > |
| |
| Velocity Tools |
| </div> |
| <div class="xright"> <a href="../../../engine/devel/">Engine</a> |
| | |
| <a href="../">Tools</a> |
| | |
| <a href="../../../anakia/devel/">Anakia</a> |
| | |
| <a href="../../../texen/devel/">Texen</a> |
| | |
| <a href="../../../docbook/">DocBook</a> |
| | |
| <a href="../../../dvsl/devel/">DVSL</a> |
| | |
| <a href="../../../engine/devel/">Engine</a> |
| | |
| <a href="../">Tools</a> |
| | |
| <a href="../../../anakia/devel/">Anakia</a> |
| | |
| <a href="../../../texen/devel/">Texen</a> |
| | |
| <a href="../../../docbook/">DocBook</a> |
| | |
| <a href="../../../dvsl/devel/">DVSL</a> |
| |
| |
| |
| |
| |
| |
| |
| |
| </div> |
| <div class="clear"> |
| <hr/> |
| </div> |
| </div> |
| <div id="leftColumn"> |
| <div id="navcolumn"> |
| |
| |
| |
| |
| |
| |
| |
| |
| <h5>VelocityTools</h5> |
| <ul> |
| |
| <li class="none"> |
| <a href="../index.html">Velocity Tools parent module</a> |
| </li> |
| </ul> |
| <h5>Overview</h5> |
| <ul> |
| |
| <li class="none"> |
| <a href="index.html">Introduction</a> |
| </li> |
| |
| <li class="none"> |
| <a href="plugin-info.html">Goals</a> |
| </li> |
| |
| <li class="none"> |
| <strong>Usage</strong> |
| </li> |
| </ul> |
| <h5>Project Documentation</h5> |
| <ul> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <li class="collapsed"> |
| <a href="project-info.html">Project Information</a> |
| </li> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <li class="collapsed"> |
| <a href="project-reports.html">Project Reports</a> |
| </li> |
| </ul> |
| <a class="poweredBy" href="http://maven.apache.org/" title="Built by Maven"> |
| <img class="poweredBy" alt="Built by Maven" src="./images/logos/maven-feather.png"></img> |
| </a> |
| |
| <iframe src="http://www.apache.org/ads/buttonbar.html" |
| style="border-width:0; float: left" frameborder="0" scrolling="no" |
| width="135" |
| height="265" ></iframe> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| </div> |
| </div> |
| <div id="bodyColumn"> |
| <div id="contentBox"> |
| <div class="section"><h2>Usage<a name="Usage"></a></h2><p>The Velocity Tools Maven plugin contains mojos to work together with Velocity Tools.</p><div class="section"><h3>Generate Velocity directives from JSP tag libraries.<a name="Generate_Velocity_directives_from_JSP_tag_libraries."></a></h3><p>JSP tag libraries can be wrapped into Velocity directives to use them into Velocity templates.</p><p>Create a new project and configure the plugin.</p><div><pre><build> |
| <plugins> |
| <plugin> |
| <groupId>org.apache.velocity</groupId> |
| <artifactId>maven-velocity-tools-plugin</artifactId> |
| <version>2.1.0-SNAPSHOT</version> |
| <configuration> |
| <packageName>org.apache.velocity.tools.examples.displaytag</packageName> |
| <prefix>display</prefix> |
| <tld>META-INF/displaytag.tld</tld> |
| </configuration> |
| <dependencies> |
| <dependency> |
| <groupId>displaytag</groupId> |
| <artifactId>displaytag</artifactId> |
| <version>1.2</version> |
| </dependency> |
| </dependencies> |
| <executions> |
| <execution> |
| <id>directive-generation</id> |
| <goals> |
| <goal>taglib2directive</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| </plugins> |
| </build></pre></div><p>In this case we are wrapping DisplayTag. Notice the fact that DisplayTag is configured as a dependency of the plugin itself, because it uses it to reflect some properties from the original tag library.</p><p>Add a dependency to the taglib itself:</p><div><pre><dependencies> |
| <dependency> |
| <groupId>displaytag</groupId> |
| <artifactId>displaytag</artifactId> |
| <version>1.2</version> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.velocity</groupId> |
| <artifactId>velocity</artifactId> |
| <version>1.6</version> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.velocity</groupId> |
| <artifactId>velocity-tools-view-jsp</artifactId> |
| <version>2.1.0-SNAPSHOT</version> |
| </dependency> |
| </dependencies></pre></div><p>To use it, in your <tt>velocity.properties</tt> file, add the list of generated directives this way:</p><div><pre>userdirective=org.apache.velocity.tools.examples.displaytag.CaptionTagDirective,\ |
| org.apache.velocity.tools.examples.displaytag.ColumnTagDirective,\ |
| org.apache.velocity.tools.examples.displaytag.SetPropertyTagDirective,\ |
| org.apache.velocity.tools.examples.displaytag.TableFooterTagDirective,\ |
| org.apache.velocity.tools.examples.displaytag.TableTagDirective</pre></div></div></div> |
| </div> |
| </div> |
| <div class="clear"> |
| <hr/> |
| </div> |
| <div id="footer"> |
| <div class="xright">© |
| 2002-2011 |
| |
| The Apache Software Foundation |
| |
| |
| |
| |
| |
| |
| |
| |
| Last Published: 2011-04-13 16:53:02 |
| </div> |
| <div class="clear"> |
| <hr/> |
| </div> |
| </div> |
| </body> |
| </html> |