The last release is included at the root of the archive directory, but if you want to re-build the library, you need to have ant installed.
./build/build.xml file contains the following ant targets:
Then, you have to set up the Velosurf tools by means of the
/WEB-INF/toolbox.xml (for 1.4):
<?xml version="1.0"?> <toolbox> <!-- toolbox file for Velocity View 1.4 --> <!-- ...other tools... --> <!-- http query parameters tool: You can either use org.apache.velocity.tools.view.tools.ParameterParser or velosurf.web.HttpQueryTool, which inherits the former to add a generic setter - in clear, if using VelocityTools 1.4 or prior, you have to use the Velosurf version if you want to be able to add values to the tool like with #set($query.foo='bar').--> <tool> <key>query</key> <scope>request</scope> <class>velosurf.web.HttpQueryTool</class> </tool> <!-- database --> <tool> <key>db</key> <scope>request</scope> <class>velosurf.web.VelosurfTool</class> <-- uncomment the next line tu use a custom model file --> <--<param name='config' value='./WEB-INF/mymodel.xml'/>--> </tool> </toolbox>
/WEB-INF/tools.xml (for 2.0+):
<?xml version="1.0"?> <tools> <!-- toolbox file for Velocity View 2.0+ --> <!-- ... other toolboxes ... --> <toolbox scope="request"/> <!-- or other scopes, see below --> <!-- ... other tools ... --> <tool key="db" class="velosurf.web.VelosurfTool"/> <!-- add «config="/WEB-INF/mymodel.xml"» for a custom model file --> </toolbox> </toolbox>
velosurf.web.VelosurfToolobject is a tiny wrapper that doesn't introduce any overhead when instanciated for each request, but you may choose to use it in a session or application scope if you do not use per-request refinements or orderings.
Alternatively, the name of the configuration file can also be specified in the
velosurf.config servlet context parameter
(this latter method must be chosen when using Velosurf authentication or localization filters that rely on the database since the toolbox
is not yet initialized at the time the filters are initialized). In that case, you'll have to put the following declaration in
By default, the database will be reverse engineered and each table becomes an entity, each column an attribute, and each foreign key will produce two attributes (see the paragraph about foreign keys in the User Guide).
You can thus start with the minimal configuration, which only specifies the database connection parameters (don't forget to specify the schema if you use one):
<?xml version="1.0"?> <database user='login' password='password' url='database_url' schema='the_schema'> </database>
You can then check your installation with a very simple template that displays a few values taken from the database.
The model file supports the XML XInclude mechanism, which lets you split a big model into many files.