Why can the processing not occur before you put the list/array into the
context?  This would be the MVC thing to do and would simplify things
greatly.

Scott
-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
.Mac Chat/AIM: seade at mac dot com


On 31/12/2002 5:30 PM, "Eigen Technology Pty Ltd"
<[EMAIL PROTECTED]> wrote:

> Well, the reason I raised the question was because I tried and failed
> using arrays, lists etc when passon to Velocity, i.e.
> 
> context.put("entry", some_list/some_array);
> have FAILED.
> 
> This is what I did:
> 
> 1. I have a Vector A;   <------ context.put("entry", A) is OK with Velocity.
> 2. But I need to do some work on the data in A. So:
> 3. Extract Object a = A.elementAt(some_position); Do what I have to do AND:
> 4. Put it back into another Vector B.
>  B.add(modified_a);
>  context.put("entry", B);
> 
> BUT velocity does not like it.
> 
> I tried to vary Vector B with Array B, List B, nothing worked, anyone know
> where I have done wrong?
> 
> cheers
> michael
> 
> 
> 
> 
> 
> 
>> 
>> or you could probably use an array of an array directly.
>> 
>> On Monday, December 30, 2002, at 04:24  PM, Scott Eade wrote:
>> 
>>> Michael,
>>> 
>>> Most people on this list will argue strongly that your velocity
>>> templates
>>> should contain only formatting code and never processing code - put
>>> this
>>> instead in a pull tool or the screen classes.
>>> 
>>> Provide a method in your pull tool that provides the data you need -
>>> this
>>> might instantiate and populate a Vector or whatever else you want to
>>> do.
>>> 
>>> I don't really understand the specific example you are attempting to
>>> describe below, but an object is an object, whether it is created by
>>> Turbine, Torque, your pull tool or screen class - and Velocity should
>>>  be
>>> able to access it and work with it provided that you have somehow made
>>>   it
>>> available to the context.
>>> 
>>> One thing you can't do in velocity (and shouldn't be able to do) is
>>> instantiate non-primitives (other than String).  You can create
>>> references
>>> to objects, arrays, Strings and ints using #set.
>>> 
>>> BTW: You may like to use ArrayList in preference to Vector.
>>> 
>>> HTH,
>>> 
>>> Scott
>>> --
>>> Scott Eade
>>> Backstage Technologies Pty. Ltd.
>>> http://www.backstagetech.com.au
>>> .Mac Chat/AIM: seade at mac dot com
>>> 
>>> 
>>> On 31/12/2002 10:56 AM, "Eigen Technology Pty Ltd"
>>> <[EMAIL PROTECTED]> wrote:
>>> 
>>>> Thanks for the advice,
>>>> 
>>>> I knew the Pull Tool part. But my question was on how to create a
>>>> Vector
>>>> in this PullTool.
>>>> 
>>>> Say you have 100 rows of data each with 6 cols in your
>>>> 
>>>> $DateTool.TodaysDate()
>>>> 
>>>> function. Before you pass it to Velocity, you have to package them in
>>>>   a
>>>> Vector first, right (correct me if I am wrong)? If this vector is not
>>>>   from
>>>> Turbine, how do you create it?
>>>> 
>>>> cheers
>>>> michael
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> 
>>>>> you have to configure your TR.properties file. Configure the pull
>>>>> service by adding a line like
>>>>> 
>>>>> services.PullService.tool.<scope>.<id> = <classname>
>>>>> 
>>>>> for example:
>>>>> 
>>>>> services.PullService.tool.request.date=com.clavie.myEvents.tool.DateT
>>>>>  ool
>>>>> 
>>>>> then, you should be able to access it in Velocity with sth like:
>>>>> $DateTool.TodaysDate()
>>>>> 
>>>>> David
>>>>> 
>>>>> On Monday, December 30, 2002, at 03:37  PM, Eigen Technology Pty Ltd
>>>>> wrote:
>>>>> 
>>>>>> When Turbine extract data from a database, it creates a Vector and
>>>>>> returns
>>>>>> for Velocity to display.
>>>>>> 
>>>>>> If I want to write a Java Utility, some tabulated calculated
>>>>>> results are
>>>>>> to be passed on to Velocity, i.e. Vectors not created by Turbine,
>>>>>> how
>>>>>> should I do it.
>>>>>> 
>>>>>> I tried:
>>>>>> 
>>>>>> Vector TEST=null;
>>>>>> 
>>>>>> etc....
>>>>>> 
>>>>>> for(i=0; i < somelimit; ++i) {
>>>>>> TEST.add(someobject(i));
>>>>>> }
>>>>>> etc....
>>>>>> 
>>>>>> return TEST;
>>>>>> 
>>>>>> Velocity displays nothing, help is much appreciated.
>>>>>> 
>>>>>> michael
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> To unsubscribe, e-mail:
>>>>>> <mailto:[EMAIL PROTECTED]>
>>>>>> For additional commands, e-mail:
>>>>>> <mailto:[EMAIL PROTECTED]>
>>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> To unsubscribe, e-mail:
>>>>> <mailto:[EMAIL PROTECTED]> For additional
>>>>> commands, e-mail: <mailto:[EMAIL PROTECTED]>
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> To unsubscribe, e-mail:
>>>> <mailto:[EMAIL PROTECTED]>
>>>> For additional commands, e-mail:
>>>> <mailto:[EMAIL PROTECTED]>
>>>> 
>>> 
>>> 
>>> --
>>> To unsubscribe, e-mail:
>>> <mailto:[EMAIL PROTECTED]>
>>> For additional commands, e-mail:
>>> <mailto:[EMAIL PROTECTED]>
>>> 
>> 
>> 
>> --
>> To unsubscribe, e-mail:
>> <mailto:[EMAIL PROTECTED]> For additional
>> commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to