I've implemented a 'resultSet' type for vpp:context,
which adds an ArrayList of HashMaps to the velocity
context. This way I can process a db result in a
template with vpp. The syntax looks like:
...
<context>
<resultSet key="dbResult" driver="${db.driver}"
url="${db.url}" userid="${db.user}"
password="${db.password}" query="select col1 from tab1"/>
</context>
...
The template can then look like this:
...
#foreach ($record in $dbResult)
<tag>NAME="$record.COL1";</tag>
#end
...
If anyone is interested, I could contribute the code.
It's not much, just one new class VPPResultSet.java and
a new method (addConfiguredResultSet) in VPPContext.
But the result is very useful (at least for me).
Nobody/Anonymous ( nobody ) - 2004-12-06 12:13
5
Open
None
Nobody/Anonymous
None
None
Public
|
Date: 2004-12-06 12:29 Logged In: YES |
|
Date: 2004-12-06 12:28 Logged In: YES |
Copyright © 2010 Geeknet, Inc. All rights reserved. Terms of Use