velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis <brede...@mac.com>
Subject Re: Doing our part to make JSP look safe! Was : Re: OT: MVC Purity :-)
Date Sat, 10 Jan 2004 11:54:24 GMT

Le 8 janv. 04, à 21:22, Geir Magnusson Jr a écrit :

>>> Jython integration standard?
>>
>> Put down the crack pipe :)
>
> Obviously, Denis was kind and handed it to me.  Anyone want me to 
> check this in in contrib?
>

He he he, very funny!
Now Velocity looks like JSP... lol

I was more thinking into having a *separate* script file that puts 
interesting stuff into the context, like macros or tools.

For example you could do your floating point arithmetic in the script 
file, as it doesn't really belong to the "view" ;-)

The simplest use would be that if Velocity finds a "foo.py", it runs 
that before loading "foo.vm".
My idea is that one could then avoid the java compilation phase when 
changing little stuff in the app.
-- Denis.

> ---- template -----
>
> ## setup some data
>
> #set($i = 10)
> #set($array = [1,10,20])
>
> ## work w/ it in beanshell
>
> #script("beanshell"  "ctx")
>
>    System.out.println("bsh : " + ctx.get("i"));
>
>    for(int j = 0; j < array.size(); j++)
>    {
>        System.out.println(array.get(j));
>    }
>
> #end
>
> ## and now in jython
>
> #script("jython" "ctx")
>
> print "jython : ", ctx.get("i")
>
> for n in array:
>     print n
>
> #end
>
>
> ---   output -------
>
> bsh : 10
> 1
> 10
> 20
>
>
>
>
>
>
> jython :  10
> 1
> 10
> 20
>
>
>
> -- 
> Geir Magnusson Jr                                   203-247-1713(m)
> geir@4quarters.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Mime
View raw message