You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by ARNULFO Franck <FA...@CPR.FR> on 2001/08/21 21:49:51 UTC
RE: Testing Velocity on the live way ;-)
All my apologies for the size of the war file :-(
I've think about it after the too fast clic on Send button...
You'll find the war (which include sources) file on
http://pipoware.free.fr/velocity/velolive.war
...
> For those who want to test Velocity in the shortest way ;-),
> I've make a very simple web application where you can type
> on a first textarea some java code for adding some object to
> a VelocityContext
> and on the second put some Velocity VTL code.
> Then press See button and tada ... , you can see the merge on
> a new browser window !
>
> I've joined the war file which contain also the sources.
> For interpreting java code, I've used the
> simple/lightweight/great BeanShell (http://www.beanshell.org).
>
> Some sample code to cut and paste:
> BeanShell script:
> v = new Vector();
> v.add(new String("Un"));
> v.add(new String("Deux"));
> v.add(new String("Trois"));
> v.add(new String("Zero"));
> context.put("list", v);
> org.apache.velocity.app.tools.VelocityFormatter formatter =
> new org.apache.velocity.app.tools.VelocityFormatter(context);
> context.put("formater", formatter);
>
> VTL:
> $formater.makeAlternator("rowcolor", "#C0C0C0", "#FFFFFF")
> <table border="0">
> #foreach( $element in $list)
> <tr bgcolor="$rowcolor">
> <td>$velocityCount</td>
> <td>$element</td>
> </tr>
> $rowcolor.alternate()
> #end
> </table>
>
> Just be carreful about deploying this web application on an
> internet server :
> BeanShell code can execute any java code ;-)
> Sample BSH:
> context.put("dir", new java.io.File("/").list());
> Sample VTL
> #foreach($f in $dir)
> $f <br>
> #end
>
> I hope it's a funny way to test Velocity and may be it can be
> also usefull ;-)
>
> Franck Arnulfo
>