velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Why cant I pass "arrays" to object methods?
Date Sat, 10 Feb 2001 03:17:50 GMT
Consider the following VTL:

    #set ($array=["not", "my"])
    #foreach ($r in $array)

this works as expected. 

And if I do 

$object.methodA("string") – this works,	// methodA takes a string

But if I do

$object.methodB($array)	// methodB takes an Object[]

and I have a method named method in the object "represented" by $object – 
and the method takes an Object[] as a parameter it does not work.

I have also tried with a methodB that takes a String[] - still dont work..

BUT if I do
$object.methodB($anotherobject) and the $anotherobject represents an 
actual array (set previously in thecontext of course) then it does work.

Any ideas as to why this doesnt work and how to fix it...I think being 
able to create Object[] arrays using the ["aaa",$raaa] syntax is very 
important. And the doco says that using ["aaa", $bcd] is a "object array" 
in the users guide...

I am not quite yet on the mailing list so I would appreciate replies to

Mike Papper

View raw message