AppFuseVelocity |
|
Your trail: |
This is version 3.
It is not the current version, and thus it cannot be edited.
[Back to current version]
[Restore this version]
Part I:: Integrating Velocity into AppFuse - A HowTo for adding the Velocity Templating engine to AppFuse applications for rendering views.
About this Tutorial
This tutorial will show you how to modify the Ant build script to include Velocity into the build cycle for AppFuse.
Table of Contents
- Download the prerequisite packages
- Add the packages to AppFuse's lib structure
- Modify the build script to include the packages
- Add the ViewServlet definition
- Configure the Toolbox and Velocity Engine
- Modify an ActionForward to send to Velocity
Download the prerequistie packages
First we need to get our hands on the VelocityTools packages. These are available from the Jakarta Apache Project.
Personally I used Velocity-Tools-1.0-bin, from here.
Add the packages to AppFuse's lib structure
The main distribution comes with all sorts of other things, including sample applications, that we don't need. We will extract the precompiled JARs (or make them if you were brave and got a source distribution). The ones we're interested in are the ones that start "velocity-". All of the other dependencies are already in AppFuse.
We now need to add this to the the lib folder in your AppFuse source tree. Create a directory lib/velocity-tools-1.0.
Now add the following to lib.properties
-
- Velocity View Tools - http://jakarta.apache.org/velocity/tools/
-
velocity.version = 1.0
velocity.dir=${lib.dir}/velocity-tools-${velocity.version}
Modify the build script to include these packages
Now that AppFuse is aware of the new libraries, we need to include them in the build process. Those of you scared of ant build scripts look away now.
We must modify the package-web target, to add the following to the lib directives for the war task:
Plugin insertion failed: Unsupported parameter 'include'.Parameter | Description | Example |
---|
style | supported styles are: Eclipse, Kawa, Monochrome | style='monochrome' | printVersion | If specified, the plugin only prints its name an version. | printVersion='true' | border | boolean flag for rendering a table border around the converted result. Default is false
| border='true' | attachment | If specified, the source code from the attached Java file will be used. | attachment='HelloWorld.java' | lineNumbers | boolean flag for rendering line numbers. Default is false | lineNumbers='true' | alignment | Specifies the horizontal alignment of the output. Supported values are: left, center, right default is left . | alignment='center' | tabSize | Number of spaces representing a tab character. Default is 2 . | tabSize='4' | url | If specified, the source code from the Java file given by the url will be used (only available if this option is enabled in the wiki properties). | url='http://www.java2html.de/HelloWorld.java' | source | If specified, the source code contained in this parameter value will be used (only valid for one line of code). | source='public final static main(String[] args);' |
So the full war task definition becomes thus:
Plugin insertion failed: Unsupported parameter 'destfile'.Parameter | Description | Example |
---|
style | supported styles are: Eclipse, Kawa, Monochrome | style='monochrome' | printVersion | If specified, the plugin only prints its name an version. | printVersion='true' | border | boolean flag for rendering a table border around the converted result. Default is false
| border='true' | attachment | If specified, the source code from the attached Java file will be used. | attachment='HelloWorld.java' | lineNumbers | boolean flag for rendering line numbers. Default is false | lineNumbers='true' | alignment | Specifies the horizontal alignment of the output. Supported values are: left, center, right default is left . | alignment='center' | tabSize | Number of spaces representing a tab character. Default is 2 . | tabSize='4' | url | If specified, the source code from the Java file given by the url will be used (only available if this option is enabled in the wiki properties). | url='http://www.java2html.de/HelloWorld.java' | source | If specified, the source code contained in this parameter value will be used (only valid for one line of code). | source='public final static main(String[] args);' |
|