velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: Why cant I pass "arrays" to object methods?
Date Sat, 10 Feb 2001 05:24:19 GMT
It's an ArrayList, not an Object[].  Sorry about that.  We'll update the
documentation.

geir

mike@bodaro.com wrote:
> 
> Consider the following VTL:
> 
>     #set ($array=["not", "my"])
>     #foreach ($r in $array)
>         $r
>     #end
> 
> 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@bodaro.com.
> 
> Mike Papper

-- 
Geir Magnusson Jr.                               geirm@optonline.com
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity

Mime
View raw message