Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
AppFuseSupport
Articles
Articles_cn
Articles_de
Articles_pt
Articles_zh




JSPWiki v2.2.33

[RSS]


Hide Menu

AppFuseVelocity


This is version 2. 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

  • [1] Download the prerequisite packages
  • [2] Add the packages to AppFuse's lib structure
  • [3] Modify the build script to include the packages
  • [4] Add the ViewServlet definition
  • [5] Configure the Toolbox and Velocity Engine
  • [6] Modify an ActionForward to send to Velocity

Download the prerequistie packages [#1]

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 [#2]

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 [#3]

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'.

ParameterDescriptionExample
attachmentIf specified, the source code from the attached Java file will be used.attachment='HelloWorld.java'
urlIf 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'
sourceIf 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);'
stylesupported styles are: Eclipse, Kawa, Monochromestyle='monochrome'
printVersionIf specified, the plugin only prints its name an version.printVersion='true'
borderboolean flag for rendering a table border around the converted result. Default is falseborder='true'
lineNumbersboolean flag for rendering line numbers. Default is falselineNumbers='true'
alignmentSpecifies the horizontal alignment of the output. Supported values are: left, center, right default is left.alignment='center'
tabSizeNumber of spaces representing a tab character. Default is 2.tabSize='4'
So the full war task definition becomes thus:

Plugin insertion failed: Unsupported parameter 'destfile'.

ParameterDescriptionExample
attachmentIf specified, the source code from the attached Java file will be used.attachment='HelloWorld.java'
urlIf 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'
sourceIf 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);'
stylesupported styles are: Eclipse, Kawa, Monochromestyle='monochrome'
printVersionIf specified, the plugin only prints its name an version.printVersion='true'
borderboolean flag for rendering a table border around the converted result. Default is falseborder='true'
lineNumbersboolean flag for rendering line numbers. Default is falselineNumbers='true'
alignmentSpecifies the horizontal alignment of the output. Supported values are: left, center, right default is left.alignment='center'
tabSizeNumber of spaces representing a tab character. Default is 2.tabSize='4'



Go to top   More info...   Attach file...
This particular version was published on 06-Nov-2006 13:52:27 MST by 217.158.192.171.