Project Documentation

Built by Maven

What is S2Velocity

First of all, S2Velocity is an extension of Velocity Tools, in order to manage toolbox instance with S2Container(Seasar2).

In web application with Velocity and Velocity Tools, typically, some view helper classes are used and they are called "toolbox". Of course toolbox classes are not only Velocity Tools built-in, but also developer can use any POJO classes as toolbox. However, Velocity Tools manages life-cycle of their instances, so that some POJO classes which need to work with other classes assumed to be given in dependency-injection way, it is hard to manage the dependencies with Velocity Tools.

For example, a POJO class must have interactions with service/dao layer class so that the POJO class have a reference to a instance of depending class. Velocity Tools is not a dependency injection container so user cannot inject a class outside the POJO class.

S2Velocity replaces instance management of Velocity Tools with S2Container. S2Velocity can make web application being consistent about instance management.

Two ways of definition

S2Velocity supports two ways to define a toolbox.

  • by (Velocity Tools compatible) XML
  • by S2Container namespace

See usage for more details.

Prerequisite for using S2Velocity

  • Velocity(Core) 1.5
  • Velocity-tools 1.3
  • S2Container 2.3.23 or 2.4.25
  • J2SE 1.5 or later