You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Garey Mills <gm...@library.berkeley.edu> on 2007/09/17 21:05:06 UTC

What does Java see a Velocity array as?

Hi -

    I am trying to call a Java method from Velocity. The method expects 
an array as an argument. I thought this would work (from the Velocity 
Users Guide)

$person.setAttributes( ["Strange", "Weird", "Excited"] )


but my method is apparently not being called. In the example above, what would be the signature of the
the Java method person.setAttributes()?

Garey Mills



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


Re: What does Java see a Velocity array as?

Posted by Garey Mills <gm...@library.berkeley.edu>.
Nathan -

    Thank you. That works. Is this documented somewhere?

Nathan Bubna wrote:
> in other words, the [] notation in Velocity creates a List, not an array.
>
> On 9/17/07, Nathan Bubna <nb...@gmail.com> wrote:
>   
>> public void setAttributes(List list);
>>
>> On 9/17/07, Garey Mills <gm...@library.berkeley.edu> wrote:
>>     
>>> Hi -
>>>
>>>     I am trying to call a Java method from Velocity. The method expects
>>> an array as an argument. I thought this would work (from the Velocity
>>> Users Guide)
>>>
>>> $person.setAttributes( ["Strange", "Weird", "Excited"] )
>>>
>>>
>>> but my method is apparently not being called. In the example above, what would be the signature of the
>>> the Java method person.setAttributes()?
>>>
>>> Garey Mills
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>>> For additional commands, e-mail: user-help@velocity.apache.org
>>>
>>>
>>>       
>
>   

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


Re: What does Java see a Velocity array as?

Posted by Nathan Bubna <nb...@gmail.com>.
in other words, the [] notation in Velocity creates a List, not an array.

On 9/17/07, Nathan Bubna <nb...@gmail.com> wrote:
> public void setAttributes(List list);
>
> On 9/17/07, Garey Mills <gm...@library.berkeley.edu> wrote:
> > Hi -
> >
> >     I am trying to call a Java method from Velocity. The method expects
> > an array as an argument. I thought this would work (from the Velocity
> > Users Guide)
> >
> > $person.setAttributes( ["Strange", "Weird", "Excited"] )
> >
> >
> > but my method is apparently not being called. In the example above, what would be the signature of the
> > the Java method person.setAttributes()?
> >
> > Garey Mills
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> > For additional commands, e-mail: user-help@velocity.apache.org
> >
> >
>

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


Re: What does Java see a Velocity array as?

Posted by Nathan Bubna <nb...@gmail.com>.
public void setAttributes(List list);

On 9/17/07, Garey Mills <gm...@library.berkeley.edu> wrote:
> Hi -
>
>     I am trying to call a Java method from Velocity. The method expects
> an array as an argument. I thought this would work (from the Velocity
> Users Guide)
>
> $person.setAttributes( ["Strange", "Weird", "Excited"] )
>
>
> but my method is apparently not being called. In the example above, what would be the signature of the
> the Java method person.setAttributes()?
>
> Garey Mills
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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