You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Eigen Technology Pty Ltd <mi...@eigentechnology.com> on 2002/12/27 06:00:08 UTC

A Java Question...

I have a db Table consisting of 10 (say col_A, col_B, col_C, col_D, ...
col_J) columns.  After accessing these data using a PullTool (as suggested
by Scott and Peter), I stored them in a Vector/List. Before I display them
in my .vm file, I want to perform some filtering, e.g. select col_A =
"some_Text".

The question is:

I can extract what is in the Vector as Objects which has all ten columns
in it, it returns a certain address. But How do I get data in col_A out
and perform the filtering I intended to do?

best wishes
michael



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Say I pulled some data from a database:

ID    Col_2     Col_3
1      A          10
2      B          20
3      C          50
4      D          100
5      E          0.5


I then perfomed some arithmatic manipulation, e.g. invert all the number
in Col_2, and now my new data are:

ID    Col_2     Col_3
1      A          0.1
2      B          0.05
3      C          0.02
4      D          0.01
5      E          20

I now want to pass these data to Velocity, I have to encapsulate them in a
Vector first. How do I do that?

If I have a Vector TEST,

TEST.addElement(??)

will only work for single col arrays. My case need to have the data put
into some form of Objects and then create the Vector ... which is what I
am asking for... thanks

michael












>
> hum, not sure what you mean by "this vector is not from Turbine". You
> can get the contents of your vector from Turbine, directly from a
> database, or anywhere else. Can you give me more infos?
>
>
> On Monday, December 30, 2002, at 03:56  PM, Eigen Technology Pty Ltd
> 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.DateTo
>>>  ol
>>>
>>> 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:
>>>> <ma...@jakarta.apache.org>
>>>> For additional commands, e-mail:
>>>> <ma...@jakarta.apache.org>
>>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org> For additional
>>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by David Worms <da...@simpledesign.com>.
hum, not sure what you mean by "this vector is not from Turbine". You  
can get the contents of your vector from Turbine, directly from a  
database, or anywhere else. Can you give me more infos?


On Monday, December 30, 2002, at 03:56  PM, Eigen Technology Pty Ltd  
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.DateTo 
>> ol
>>
>> 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:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
> --
> To unsubscribe, e-mail:    
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:  
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by Colin Chalmers <co...@maxware.nl>.
The only thing that I can see, and that's probably more to do with your
example, is that you use "entry" twice.

Do you have logs/stacktraces we could look at?

/c

----- Original Message -----
From: "Eigen Technology Pty Ltd" <mi...@eigentechnology.com>
To: <tu...@jakarta.apache.org>
Sent: Tuesday, December 31, 2002 7:30 AM
Subject: Re: Howto create a VECTOR for Velocity


> 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"
> >> <mi...@eigentechnology.com> 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:
> >>>>> <ma...@jakarta.apache.org>
> >>>>> For additional commands, e-mail:
> >>>>> <ma...@jakarta.apache.org>
> >>>>>
> >>>>
> >>>>
> >>>> --
> >>>> To unsubscribe, e-mail:
> >>>> <ma...@jakarta.apache.org> For additional
> >>>> commands, e-mail: <ma...@jakarta.apache.org>
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> To unsubscribe, e-mail:
> >>> <ma...@jakarta.apache.org>
> >>> For additional commands, e-mail:
> >>> <ma...@jakarta.apache.org>
> >>>
> >>
> >>
> >> --
> >> To unsubscribe, e-mail:
> >> <ma...@jakarta.apache.org>
> >> For additional commands, e-mail:
> >> <ma...@jakarta.apache.org>
> >>
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org> For additional
> > commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by Scott Eade <se...@backstagetech.com.au>.
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"
<mi...@eigentechnology.com> 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"
>>> <mi...@eigentechnology.com> 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:
>>>>>> <ma...@jakarta.apache.org>
>>>>>> For additional commands, e-mail:
>>>>>> <ma...@jakarta.apache.org>
>>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> To unsubscribe, e-mail:
>>>>> <ma...@jakarta.apache.org> For additional
>>>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> To unsubscribe, e-mail:
>>>> <ma...@jakarta.apache.org>
>>>> For additional commands, e-mail:
>>>> <ma...@jakarta.apache.org>
>>>> 
>>> 
>>> 
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>>> 
>> 
>> 
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
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"
>> <mi...@eigentechnology.com> 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:
>>>>> <ma...@jakarta.apache.org>
>>>>> For additional commands, e-mail:
>>>>> <ma...@jakarta.apache.org>
>>>>>
>>>>
>>>>
>>>> --
>>>> To unsubscribe, e-mail:
>>>> <ma...@jakarta.apache.org> For additional
>>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>
>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by David Worms <da...@simpledesign.com>.
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"
> <mi...@eigentechnology.com> 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:
>>>> <ma...@jakarta.apache.org>
>>>> For additional commands, e-mail:
>>>> <ma...@jakarta.apache.org>
>>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org> For additional
>>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:    
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:  
>> <ma...@jakarta.apache.org>
>>
>
>
> --
> To unsubscribe, e-mail:    
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:  
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by Scott Eade <se...@backstagetech.com.au>.
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"
<mi...@eigentechnology.com> 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.DateTool
>> 
>> 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:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>>> 
>> 
>> 
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
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.DateTool
>
> 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:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Howto create a VECTOR for Velocity

Posted by David Worms <da...@simpledesign.com>.
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.DateTool

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:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Howto create a VECTOR for Velocity

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: A Java Question... not working.

Posted by Scott Eade <se...@backstagetech.com.au>.
On 28/12/2002 10:04 AM, "Eigen Technology Pty Ltd"
<mi...@eigentechnology.com> wrote:

> it might help if I would be allowed to have a
> look at the Turbine's source code.

http://cvs.apache.org/viewcvs/jakarta-turbine-2/

Cheers,

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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: A Java Question... not working.

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
I guess this question can be addressed by the author of Turbine :-). 
Since we can extract data by doing:

$document.XXX in .vm

the author must have a way of extracting data from the $document object.
Since I can't extract the data using my methods (and/or all those who has
offered me assisstance), it might help if I would be allowed to have a
look at the Turbine's source code.

thanks
michael



> Thanks to all,
>
> I have tried all that suggested, unfortunately none worked ... What Wei
> has suggested compiles OK, but nothing got returned. Here is my
> procedure again:
>
> 1. Extract data from DB using a PullTool
> 2. Data is encapsulated in a Vector.
> 3. Each element in this Vector contains a single row of data (multiple
> col). 4. Try to extract a single col of datum from a single row.
>
> The first time when I perform the elementAt(1), it is OK, it returns a
> list of Objects. I can get Velocity to display its contents by
>
> $documents.XXX
>
> If I perform toString() on these objects, I get only the Address of the
> objects. If I perform another elementAt(x), nothing got returned. I am a
> bit confused here, how is object-strings converted in general?
>
> thanks
> michael
>
>
>
>
>
>
>
>>
>> Your right hand side is an Object, you need to do a cast.  That is:
>>
>> String test = (String)((Object)docs.elementAt(1)).elementAt(1);
>>
>> or
>>
>> String test = ((Doc)docs.get(1)).getDocString();
>>
>> or
>>
>> String test = (docs.elementAt(1)).elementAt(1).toString();
>>
>> It depends on the type you have for the first field in your doc
>> object.
>>   If it is a BigDecimal, direct cast may not work, toString() will do.
>> You see my point.
>>
>> Hope this helps.
>>
>> Eigen Technology Pty Ltd wrote:
>>> I could possibly write a servlet to extract and then filter the data,
>>> but I think that would defeat the purpose of having Turbine in the
>>> first place.
>>>
>>> I tried:
>>>
>>>  String test = ((Object)docs.elementAt(1)).elementAt(1);
>>>  return test;
>>>
>>> the compiler did not complain, but Velocity rejected it. Really
>>> running out of ideas. Any suggestion would be appreciated.
>>>
>>> cheers
>>> michael
>>>
>>>
>>>
>>>
>>>>I have a db Table consisting of 10 (say col_A, col_B, col_C, col_D,
>>>> ... col_J) columns.  After accessing these data using a PullTool (as
>>>> suggested by Scott and Peter), I stored them in a Vector/List.
>>>> Before I display them in my .vm file, I want to perform some
>>>> filtering, e.g. select col_A = "some_Text".
>>>>
>>>>The question is:
>>>>
>>>>I can extract what is in the Vector as Objects which has all ten
>>>> columns in it, it returns a certain address. But How do I get data
>>>> in col_A out and perform the filtering I intended to do?
>>>>
>>>>best wishes
>>>>michael
>>>>
>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail:
>>>><ma...@jakarta.apache.org> For additional
>>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org> For additional
>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>
>>
>>
>> --
>> Wei He
>> Email: weihe@optonline.net
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: A Java Question... not working.

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Wei,

I tried

$document.getClass().getName()

it just return with the path to one of my class files:

org.mycompany.medici.om.Contact

where Contact is the name of the Database Table. What does this mean?

cheers
michael





>
> I think the last resort is to find out what the objects really are. This
>  can be done by using getClass().getName() on each Object in your
> Collection.  This can be done in vm file, and class name of each Object
> will be printed.
>
> Once you find out what they are and call their own methods to get the
> fields you need.  Hope this helps.
>
> Eigen Technology Pty Ltd wrote:
>> Thanks to all,
>>
>> I have tried all that suggested, unfortunately none worked ... What
>> Wei has suggested compiles OK, but nothing got returned. Here is my
>> procedure again:
>>
>> 1. Extract data from DB using a PullTool
>> 2. Data is encapsulated in a Vector.
>> 3. Each element in this Vector contains a single row of data (multiple
>> col). 4. Try to extract a single col of datum from a single row.
>>
>> The first time when I perform the elementAt(1), it is OK, it returns a
>> list of Objects. I can get Velocity to display its contents by
>>
>> $documents.XXX
>>
>> If I perform toString() on these objects, I get only the Address of
>> the objects. If I perform another elementAt(x), nothing got returned.
>> I am a bit confused here, how is object-strings converted in general?
>>
>> thanks
>> michael
>>
>>
>>
>>
>>
>>
>>
>>
>>>Your right hand side is an Object, you need to do a cast.  That is:
>>>
>>>String test = (String)((Object)docs.elementAt(1)).elementAt(1);
>>>
>>>or
>>>
>>>String test = ((Doc)docs.get(1)).getDocString();
>>>
>>>or
>>>
>>>String test = (docs.elementAt(1)).elementAt(1).toString();
>>>
>>>It depends on the type you have for the first field in your doc
>>> object.
>>>  If it is a BigDecimal, direct cast may not work, toString() will do.
>>>You see my point.
>>>
>>>Hope this helps.
>>>
>>>Eigen Technology Pty Ltd wrote:
>>>
>>>>I could possibly write a servlet to extract and then filter the data,
>>>> but I think that would defeat the purpose of having Turbine in the
>>>> first place.
>>>>
>>>>I tried:
>>>>
>>>> String test = ((Object)docs.elementAt(1)).elementAt(1);
>>>> return test;
>>>>
>>>>the compiler did not complain, but Velocity rejected it. Really
>>>> running out of ideas. Any suggestion would be appreciated.
>>>>
>>>>cheers
>>>>michael
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>I have a db Table consisting of 10 (say col_A, col_B, col_C, col_D,
>>>>> ... col_J) columns.  After accessing these data using a PullTool (as
>>>>> suggested by Scott and Peter), I stored them in a Vector/List.
>>>>> Before I display them in my .vm file, I want to perform some
>>>>> filtering, e.g. select col_A = "some_Text".
>>>>>
>>>>>The question is:
>>>>>
>>>>>I can extract what is in the Vector as Objects which has all ten
>>>>> columns in it, it returns a certain address. But How do I get data
>>>>> in col_A out and perform the filtering I intended to do?
>>>>>
>>>>>best wishes
>>>>>michael
>>>>>
>>>>>
>>>>>
>>>>>--
>>>>>To unsubscribe, e-mail:
>>>>><ma...@jakarta.apache.org> For additional
>>>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail:
>>>><ma...@jakarta.apache.org> For additional
>>>> commands, e-mail: <ma...@jakarta.apache.org>
>>>>
>>>
>>>--
>>>Wei He
>>>Email: weihe@optonline.net
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><ma...@jakarta.apache.org> For additional
>>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>
>
> --
> Wei He, Ph.D.
> Email: weihe@optonline.net
> Voice: (845)359-5621
> Fax:   (845)359-1631
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: A Java Question... not working.

Posted by Wei He <we...@ldeo.columbia.edu>.
I think the last resort is to find out what the objects really are. This 
can be done by using getClass().getName() on each Object in your 
Collection.  This can be done in vm file, and class name of each Object 
will be printed.

Once you find out what they are and call their own methods to get the 
fields you need.  Hope this helps.

Eigen Technology Pty Ltd wrote:
> Thanks to all,
> 
> I have tried all that suggested, unfortunately none worked ... What Wei
> has suggested compiles OK, but nothing got returned. Here is my procedure
> again:
> 
> 1. Extract data from DB using a PullTool
> 2. Data is encapsulated in a Vector.
> 3. Each element in this Vector contains a single row of data (multiple col).
> 4. Try to extract a single col of datum from a single row.
> 
> The first time when I perform the elementAt(1), it is OK, it returns a
> list of Objects. I can get Velocity to display its contents by
> 
> $documents.XXX
> 
> If I perform toString() on these objects, I get only the Address of the
> objects. If I perform another elementAt(x), nothing got returned. I am a
> bit confused here, how is object-strings converted in general?
> 
> thanks
> michael
> 
> 
> 
> 
> 
> 
> 
> 
>>Your right hand side is an Object, you need to do a cast.  That is:
>>
>>String test = (String)((Object)docs.elementAt(1)).elementAt(1);
>>
>>or
>>
>>String test = ((Doc)docs.get(1)).getDocString();
>>
>>or
>>
>>String test = (docs.elementAt(1)).elementAt(1).toString();
>>
>>It depends on the type you have for the first field in your doc object.
>>  If it is a BigDecimal, direct cast may not work, toString() will do.
>>You see my point.
>>
>>Hope this helps.
>>
>>Eigen Technology Pty Ltd wrote:
>>
>>>I could possibly write a servlet to extract and then filter the data,
>>>but I think that would defeat the purpose of having Turbine in the
>>>first place.
>>>
>>>I tried:
>>>
>>> String test = ((Object)docs.elementAt(1)).elementAt(1);
>>> return test;
>>>
>>>the compiler did not complain, but Velocity rejected it. Really
>>>running out of ideas. Any suggestion would be appreciated.
>>>
>>>cheers
>>>michael
>>>
>>>
>>>
>>>
>>>
>>>>I have a db Table consisting of 10 (say col_A, col_B, col_C, col_D,
>>>>... col_J) columns.  After accessing these data using a PullTool (as
>>>>suggested by Scott and Peter), I stored them in a Vector/List. Before
>>>>I display them in my .vm file, I want to perform some filtering, e.g.
>>>>select col_A = "some_Text".
>>>>
>>>>The question is:
>>>>
>>>>I can extract what is in the Vector as Objects which has all ten
>>>>columns in it, it returns a certain address. But How do I get data in
>>>>col_A out and perform the filtering I intended to do?
>>>>
>>>>best wishes
>>>>michael
>>>>
>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail:
>>>><ma...@jakarta.apache.org> For additional
>>>>commands, e-mail: <ma...@jakarta.apache.org>
>>>
>>>
>>>
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><ma...@jakarta.apache.org> For additional
>>>commands, e-mail: <ma...@jakarta.apache.org>
>>>
>>
>>--
>>Wei He
>>Email: weihe@optonline.net
>>
>>
>>--
>>To unsubscribe, e-mail:
>><ma...@jakarta.apache.org> For additional
>>commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


-- 
Wei He, Ph.D.
Email: weihe@optonline.net
Voice: (845)359-5621
Fax:   (845)359-1631


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: A Java Question... not working.

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Thanks to all,

I have tried all that suggested, unfortunately none worked ... What Wei
has suggested compiles OK, but nothing got returned. Here is my procedure
again:

1. Extract data from DB using a PullTool
2. Data is encapsulated in a Vector.
3. Each element in this Vector contains a single row of data (multiple col).
4. Try to extract a single col of datum from a single row.

The first time when I perform the elementAt(1), it is OK, it returns a
list of Objects. I can get Velocity to display its contents by

$documents.XXX

If I perform toString() on these objects, I get only the Address of the
objects. If I perform another elementAt(x), nothing got returned. I am a
bit confused here, how is object-strings converted in general?

thanks
michael







>
> Your right hand side is an Object, you need to do a cast.  That is:
>
> String test = (String)((Object)docs.elementAt(1)).elementAt(1);
>
> or
>
> String test = ((Doc)docs.get(1)).getDocString();
>
> or
>
> String test = (docs.elementAt(1)).elementAt(1).toString();
>
> It depends on the type you have for the first field in your doc object.
>   If it is a BigDecimal, direct cast may not work, toString() will do.
> You see my point.
>
> Hope this helps.
>
> Eigen Technology Pty Ltd wrote:
>> I could possibly write a servlet to extract and then filter the data,
>> but I think that would defeat the purpose of having Turbine in the
>> first place.
>>
>> I tried:
>>
>>  String test = ((Object)docs.elementAt(1)).elementAt(1);
>>  return test;
>>
>> the compiler did not complain, but Velocity rejected it. Really
>> running out of ideas. Any suggestion would be appreciated.
>>
>> cheers
>> michael
>>
>>
>>
>>
>>>I have a db Table consisting of 10 (say col_A, col_B, col_C, col_D,
>>> ... col_J) columns.  After accessing these data using a PullTool (as
>>> suggested by Scott and Peter), I stored them in a Vector/List. Before
>>> I display them in my .vm file, I want to perform some filtering, e.g.
>>> select col_A = "some_Text".
>>>
>>>The question is:
>>>
>>>I can extract what is in the Vector as Objects which has all ten
>>> columns in it, it returns a certain address. But How do I get data in
>>> col_A out and perform the filtering I intended to do?
>>>
>>>best wishes
>>>michael
>>>
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><ma...@jakarta.apache.org> For additional
>>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org> For additional
>> commands, e-mail: <ma...@jakarta.apache.org>
>>
>
>
> --
> Wei He
> Email: weihe@optonline.net
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: A Java Question...

Posted by Wei He <we...@ldeo.columbia.edu>.
Your right hand side is an Object, you need to do a cast.  That is:

String test = (String)((Object)docs.elementAt(1)).elementAt(1);

or

String test = ((Doc)docs.get(1)).getDocString();

or

String test = (docs.elementAt(1)).elementAt(1).toString();

It depends on the type you have for the first field in your doc object. 
  If it is a BigDecimal, direct cast may not work, toString() will do. 
You see my point.

Hope this helps.

Eigen Technology Pty Ltd wrote:
> I could possibly write a servlet to extract and then filter the data, but
> I think that would defeat the purpose of having Turbine in the first
> place.
> 
> I tried:
> 
>  String test = ((Object)docs.elementAt(1)).elementAt(1);
>  return test;
> 
> the compiler did not complain, but Velocity rejected it. Really running
> out of ideas. Any suggestion would be appreciated.
> 
> cheers
> michael
> 
> 
> 
> 
>>I have a db Table consisting of 10 (say col_A, col_B, col_C, col_D, ...
>>col_J) columns.  After accessing these data using a PullTool (as
>>suggested by Scott and Peter), I stored them in a Vector/List. Before I
>>display them in my .vm file, I want to perform some filtering, e.g.
>>select col_A = "some_Text".
>>
>>The question is:
>>
>>I can extract what is in the Vector as Objects which has all ten columns
>>in it, it returns a certain address. But How do I get data in col_A out
>>and perform the filtering I intended to do?
>>
>>best wishes
>>michael
>>
>>
>>
>>--
>>To unsubscribe, e-mail:
>><ma...@jakarta.apache.org> For additional
>>commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


-- 
Wei He
Email: weihe@optonline.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: A Java Question...

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
I could possibly write a servlet to extract and then filter the data, but
I think that would defeat the purpose of having Turbine in the first
place.

I tried:

 String test = ((Object)docs.elementAt(1)).elementAt(1);
 return test;

the compiler did not complain, but Velocity rejected it. Really running
out of ideas. Any suggestion would be appreciated.

cheers
michael



> I have a db Table consisting of 10 (say col_A, col_B, col_C, col_D, ...
> col_J) columns.  After accessing these data using a PullTool (as
> suggested by Scott and Peter), I stored them in a Vector/List. Before I
> display them in my .vm file, I want to perform some filtering, e.g.
> select col_A = "some_Text".
>
> The question is:
>
> I can extract what is in the Vector as Objects which has all ten columns
> in it, it returns a certain address. But How do I get data in col_A out
> and perform the filtering I intended to do?
>
> best wishes
> michael
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to configure template for web page?

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Try:

http://jakarta.apache.org/turbine/tdk/tdk-howto.html

there are a few other howtos to help you get started.

best wishes
michael




> In TurbineResources.properties, what these variables mean? And what are
> they used to do?
> I am just confused by them.
> # ------------------------------------------------------------------- #
> #  F R A M E W O R K  S E T T I N G S
> #
> # ------------------------------------------------------------------- #
> These are settings that control the behaviour of the framework,
> # such as determining whether a template system is in use, what
> # the default templates and screens are and session handling settings. #
> -------------------------------------------------------------------
>
> # Used to set the template homepage if you are using a template
> # layout.
> #
> # Default: Index.vm
>
> template.homepage=Index.vm
>
> # This is the default screen to show to people when they first access #
> the system. Specify one of the template screens such as VelocityScreen #
> to use a template system.
> #
> # Default: Login
>
> screen.homepage=
>
> # This is the template that is shown on an incorrect login attempt. #
> Setting this property will override any value of screen.login specfied #
> below.
> #
> # Default: Login.vm
>
> template.login=Login.vm
>
> # This is the page that is shown on an incorrect login attempt.  It is #
> referenced in the LoginUser action. Note that it will only be used if #
> a login template has not been specified (see template.login above). #
> # Default: Login
>
> screen.login=
>
> # This is the template that is used by the respective Template based #
> ErrorScreen for displaying the error. If you are not using a Template
> based
> # ErrorScreen, then this is ignored.
> #
> # Default: Error.vm
>
> template.error=Error.vm
>
> # This is the default error screen.
> #
> # Default: VelocityErrorScreen
>
> screen.error=VelocityErrorScreen
>
> # This is the screen that is displayed when the user's web page is in #
> an invalid state.
> #
> # Default: error.InvalidState
>
> screen.invalidstate=error.InvalidState
>
> # Set the default Doctype.  The default Doctype can be set by using #
> the single strings: Html40Strict, Html40Transitional, or
> # Html40Frameset.  Additionally the default can be supplied as two #
> strings separated by a comma giving the DTD and URI.
> #
> # Default: ignored if not set to some value.
>
> default.doctype=Html40Transitional
>
> # This is the default action to log a user in.
>
> action.login=LoginUser
>
> # This is the default action to log a user out.
>
> action.logout=LogoutUser
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: How to configure template for web page?

Posted by Quinton McCombs <qm...@nequalsone.com>.
I am going to assume that you will be using Velocity and not JSP or some
other type of view.

My comments are inline.

> -----Original Message-----
> From: John [mailto:jrhcn@hotmail.com] 
> Sent: Monday, December 30, 2002 5:07 AM
> To: Turbine Users List
> Subject: How to configure template for web page?
> 
> 
> In TurbineResources.properties, what these variables mean? 
> And what are they used to do? I am just confused by them. # 
> -------------------------------------------------------------------
> #
> #  F R A M E W O R K  S E T T I N G S
> #
> # -------------------------------------------------------------------
> # These are settings that control the behaviour of the 
> framework, # such as determining whether a template system is 
> in use, what # the default templates and screens are and 
> session handling settings. # 
> -------------------------------------------------------------------
> 
> # Used to set the template homepage if you are using a 
> template # layout. # # Default: Index.vm
> 
> template.homepage=Index.vm
>

This is the default page that Turbine will render if a specific page is
not request.  For example, if you accessed the followjng page
http://www.myapp.com/blah/servlet/sampleapp (just an example), you will
get the template listed in template.homepage.  Think of this as
Turbine's, index.html.


> # This is the default screen to show to people when they 
> first access # the system. Specify one of the template 
> screens such as VelocityScreen # to use a template system. # 
> # Default: Login
> 
> screen.homepage=
> 

Ignore this.  It is only used if you do not have a template.homepage.

> # This is the template that is shown on an incorrect login 
> attempt. # Setting this property will override any value of 
> screen.login specfied # below. # # Default: Login.vm
> 
> template.login=Login.vm
> 

This is really only used in the default login action and the secure
session validator (not enabled by default).  For the login action, this
is used on an invalid login attempt.  This is where the user will be
sent if the login fails.  This should normally, be you login template.
Make sure that somewhere on your template you display
$data.getMessage().  When the login fails, data.setMessage() is called
to store the reason for the login failure.

> # This is the page that is shown on an incorrect login 
> attempt.  It is # referenced in the LoginUser action. Note 
> that it will only be used if # a login template has not been 
> specified (see template.login above). # # Default: Login
> 
> screen.login=
> 

Ignore.  This is only used when template.login is not specified.

> # This is the template that is used by the respective 
> Template based # ErrorScreen for displaying the error. If you 
> are not using a Template based # ErrorScreen, then this is 
> ignored. # # Default: Error.vm
> 
> template.error=Error.vm

This template is displayed when an exception is thrown during the page
generation.  This could be an action that threw the exception, your
screen class, etc...  

The actual exception is added to the context as "processingException"
and the stack trace as "stackTrace".  

> 
> # This is the default error screen.
> #
> # Default: VelocityErrorScreen
> 
> screen.error=VelocityErrorScreen

Ignore.

> 
> # This is the screen that is displayed when the user's web 
> page is in # an invalid state. # # Default: error.InvalidState
> 
> screen.invalidstate=error.InvalidState

Leave this as the default.  It is used by the session validator classes
in cases where a user tries to submit stale form data.  This screen is
then displayed to the user.  This functionality is not enabled by
default.  To use it, you would add a hidden form field called
_session_access_counter in your form.  The value should be set to
$data.User.AccessCounterForSession.

If you are really interested in using this, look at the source code for
a better explaination of how it really works.  I have never used it,
myself.

> 
> # Set the default Doctype.  The default Doctype can be set by 
> using # the single strings: Html40Strict, Html40Transitional, 
> or # Html40Frameset.  Additionally the default can be 
> supplied as two # strings separated by a comma giving the DTD 
> and URI. # # Default: ignored if not set to some value.
> 
> default.doctype=Html40Transitional

Not sure...

> 
> # This is the default action to log a user in.
> 
> action.login=LoginUser
> 

Turbine handles the login and logout actions specially.  If you write
your own implmentation of the login or logout actions, you will need to
update this setting with the new class name.

> # This is the default action to log a user out.
> 
> action.logout=LogoutUser
> 
> --
> To unsubscribe, e-mail:   
> <mailto:turbine-user-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


How to configure template for web page?

Posted by John <jr...@hotmail.com>.
In TurbineResources.properties, what these variables mean? And what are they
used to do?
I am just confused by them.
# -------------------------------------------------------------------
#
#  F R A M E W O R K  S E T T I N G S
#
# -------------------------------------------------------------------
# These are settings that control the behaviour of the framework,
# such as determining whether a template system is in use, what
# the default templates and screens are and session handling settings.
# -------------------------------------------------------------------

# Used to set the template homepage if you are using a template
# layout.
#
# Default: Index.vm

template.homepage=Index.vm

# This is the default screen to show to people when they first access
# the system. Specify one of the template screens such as VelocityScreen
# to use a template system.
#
# Default: Login

screen.homepage=

# This is the template that is shown on an incorrect login attempt.
# Setting this property will override any value of screen.login specfied
# below.
#
# Default: Login.vm

template.login=Login.vm

# This is the page that is shown on an incorrect login attempt.  It is
# referenced in the LoginUser action. Note that it will only be used if
# a login template has not been specified (see template.login above).
#
# Default: Login

screen.login=

# This is the template that is used by the respective Template based
# ErrorScreen for displaying the error. If you are not using a Template
based
# ErrorScreen, then this is ignored.
#
# Default: Error.vm

template.error=Error.vm

# This is the default error screen.
#
# Default: VelocityErrorScreen

screen.error=VelocityErrorScreen

# This is the screen that is displayed when the user's web page is in
# an invalid state.
#
# Default: error.InvalidState

screen.invalidstate=error.InvalidState

# Set the default Doctype.  The default Doctype can be set by using
# the single strings: Html40Strict, Html40Transitional, or
# Html40Frameset.  Additionally the default can be supplied as two
# strings separated by a comma giving the DTD and URI.
#
# Default: ignored if not set to some value.

default.doctype=Html40Transitional

# This is the default action to log a user in.

action.login=LoginUser

# This is the default action to log a user out.

action.logout=LogoutUser

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: A Java Question...

Posted by "Jeffrey D. Brekke" <jb...@wi.rr.com>.
FWIW in commons collection's CollectionUtils class there is a method, 
select() that will select objects from a collection given conditions 
you specify.

http://jakarta.apache.org/commons/collections/api/org/apache/commons/collections/CollectionUtils.html

On Fri, 27 Dec 2002, Eigen Technology Pty Ltd wrote:

> I have a db Table consisting of 10 (say col_A, col_B, col_C, col_D, ...
> col_J) columns.  After accessing these data using a PullTool (as suggested
> by Scott and Peter), I stored them in a Vector/List. Before I display them
> in my .vm file, I want to perform some filtering, e.g. select col_A =
> "some_Text".
> 
> The question is:
> 
> I can extract what is in the Vector as Objects which has all ten columns
> in it, it returns a certain address. But How do I get data in col_A out
> and perform the filtering I intended to do?
> 
> best wishes
> michael
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 

-- 
=====================================================================
Jeffrey D. Brekke                                   jbrekke@wi.rr.com
Wisconsin,  USA                                     brekke@apache.org
                                                    ekkerbj@yahoo.com



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>