velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr <g...@4quarters.com>
Subject Doing our part to make JSP look safe! Was : Re: OT: MVC Purity :-)
Date Thu, 08 Jan 2004 21:24:58 GMT
I had posted the following to the dev list.  Figured user list might be 
amused as well...

On Jan 8, 2004, at 6:29 AM, Geir Magnusson Jr wrote:

>
> On Jan 8, 2004, at 3:16 AM, Denis wrote:
>
>>
>> Le 6 janv. 04, à 19:20, Tim Colson a écrit :
>>
>>> Hey folks -
>>>   I certainly didn't mean to lead the integer division thread off 
>>> into
>>> MVC Purity land, we've been there before and it tends to be a place
>>> where people wind up agreeing to disagree.
>>>
>>>   Serge's example sports exmaple is interesting, but if I were
>>> developing the same app, I'd pull the calculations into the Java 
>>> side so
>>> the templates were kept simple. Our choices differ.
>>
>> That's the kind of situation that makes me long for a way to write in 
>> an interpreted language tools or macros that can be used in the 
>> template.
>>
>> 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?

---- 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-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message