You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Venkatesh Prasad Ranganath <co...@yahoo.com> on 2004/06/08 03:30:29 UTC

Velocity Tool issues

I use the following template

#set ($t = $arrayTool.size($return1_array))
$arrayTool.size($return1_array)
$t

with the following tool and it's configuration


  <tool>
    <key>arrayTool</key>
    <scope>application</scope>
    <class>ArrayTool</class>
  </tool>


public class ArrayTool {
         public int size(int[] array) {
                 return array.length;
         }

     /*
         public int size(Object[] array) {
                 return array.length;
         }
         public Object get(Object[] array, int index) {
                 return array[index];
         }
     */

         public int get(int[] array, int index) {
                 return array[index];
         }

}

However, the output is

$arrayTool.size($return1_array)
$t

What's happening?  I am passing a int[] as return1_array.

-- 

Venkatesh Prasad Ranganath,
Dept. Computing and Information Science,
Kansas State University, US.
web: http://www.cis.ksu.edu/~rvprasad


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


Re: Velocity Tool issues

Posted by Venkatesh Prasad Ranganath <co...@yahoo.com>.
Venkatesh Prasad Ranganath wrote:
> I use the following template
> 
> #set ($t = $arrayTool.size($return1_array))
> $arrayTool.size($return1_array)
> $t
> 
> with the following tool and it's configuration
> 
> 
>  <tool>
>    <key>arrayTool</key>
>    <scope>application</scope>
>    <class>ArrayTool</class>
>  </tool>
> 
> 
> public class ArrayTool {
>         public int size(int[] array) {
>                 return array.length;
>         }
> 
>     /*
>         public int size(Object[] array) {
>                 return array.length;
>         }
>         public Object get(Object[] array, int index) {
>                 return array[index];
>         }
>     */
> 
>         public int get(int[] array, int index) {
>                 return array[index];
>         }
> 
> }
> 
> However, the output is
> 
> $arrayTool.size($return1_array)
> $t
> 
> What's happening?  I am passing a int[] as return1_array.
> 
Figured it out.


-- 

Venkatesh Prasad Ranganath,
Dept. Computing and Information Science,
Kansas State University, US.
web: http://www.cis.ksu.edu/~rvprasad


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