You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by turbine dev <tu...@yahoo.com> on 2001/07/14 01:39:28 UTC
how to create proper Vector object for Velocity?
Hi there,
I am trying to build a Vector object that could be put
in the context of a page so that I can loop thru the
data in a template by the following:
#foreach ($row in $myVector)
$row.column_name1
$row.column_name2
#end
The data is drawn from a ResultSet by a TurbineDB
connection and a sql statement (*not* using Peers /
Criteria). I tried to create the Vector by a member
class myObject with column_name1 and column_name2
fields and myVector.addElement(myObject).
The resulting Vector is not "velocity-compliant" and
the data cannot be retrived properly.
How could I contruct a "velocity-compliant" Vector
object that can be used to store query results and
present the data just like $Entries in the sample app?
Please help, Thanks in advance.
Sincerely,
Kenny
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Tdk2.1
Posted by Skondras Panagiotis <pa...@acn.gr>.
The Version of Ant is 1.3
Jason van Zyl wrote:
> On 7/16/01 7:31 AM, "Skondras Panagiotis" <pa...@acn.gr> wrote:
>
> > I have downloaded the 2.1 version
> > and i am trying to create a new app
> > I also download ant set the paths correct and
> > i type ant at the TDK root dir and i get
> >
> > Buildfile: build.xml
> >
> > BUILD FAILED
> >
> > Target `bin' does not exist in this project.
> >
> > Total time: 0 seconds
> >
> > I haven't change anything in the build.xml or props file
> > any Ideas
>
> I have not recently tried to download Ant to install it and
> test it.
>
> What version of Ant did you try to install?
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
> --
>
> jvz.
>
> Jason van Zyl
>
> http://tambora.zenplex.org
> http://jakarta.apache.org/turbine
> http://jakarta.apache.org/velocity
> http://jakarta.apache.org/alexandria
> http://jakarta.apache.org/commons
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Tdk2.1
Posted by Jason van Zyl <jv...@apache.org>.
On 7/16/01 7:31 AM, "Skondras Panagiotis" <pa...@acn.gr> wrote:
> I have downloaded the 2.1 version
> and i am trying to create a new app
> I also download ant set the paths correct and
> i type ant at the TDK root dir and i get
>
> Buildfile: build.xml
>
> BUILD FAILED
>
> Target `bin' does not exist in this project.
>
> Total time: 0 seconds
>
> I haven't change anything in the build.xml or props file
> any Ideas
I have not recently tried to download Ant to install it and
test it.
What version of Ant did you try to install?
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
--
jvz.
Jason van Zyl
http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Tdk2.1
Posted by Skondras Panagiotis <pa...@acn.gr>.
I have downloaded the 2.1 version
and i am trying to create a new app
I also download ant set the paths correct and
i type ant at the TDK root dir and i get
Buildfile: build.xml
BUILD FAILED
Target `bin' does not exist in this project.
Total time: 0 seconds
I haven't change anything in the build.xml or props file
any Ideas
Re: how to create proper Vector object for Velocity?
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
turbine dev wrote:
>
> Found the answer, responding to myself.
>
> in my case, the class myObject has to have accessor
> methods of get*() (ie. getcolumn_name1()) for the
> object fields. By using $row.column_name1 in the .vm,
> the Velocity engine would then call .getcolumn_name1()
> to get the field from the class.
>
> ie, .column_name1 invokes .getcolumn_name1()
>
> Maybe someone else would find this info useful...
>
And this only worked because of a convenience feature we added.
Velocity follows the bean spec, so when you do something like
$row.foo
Velocity tries
getFoo()
getfoo() [this is the convenience... it's not bean-spec]
and
get("foo")
on the object refrenced by "row" in the context.
So if you are going to make your object more bean-like, I would suggest
either changing your method to getColumn_name1() or use the get( String
) approach. The latter is nicer as then you can do things like make a
generic row wrapper to handle any table. (Or, use a java.util.Map :)
geir
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
Developing for the web? See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: how to create proper Vector object for Velocity?
Posted by turbine dev <tu...@yahoo.com>.
Found the answer, responding to myself.
in my case, the class myObject has to have accessor
methods of get*() (ie. getcolumn_name1()) for the
object fields. By using $row.column_name1 in the .vm,
the Velocity engine would then call .getcolumn_name1()
to get the field from the class.
ie, .column_name1 invokes .getcolumn_name1()
Maybe someone else would find this info useful...
Sincerely,
Kenny
--- turbine dev <tu...@yahoo.com> wrote:
> Hi there,
>
> I am trying to build a Vector object that could be
> put
> in the context of a page so that I can loop thru the
> data in a template by the following:
>
> #foreach ($row in $myVector)
> $row.column_name1
> $row.column_name2
> #end
>
> The data is drawn from a ResultSet by a TurbineDB
> connection and a sql statement (*not* using Peers /
> Criteria). I tried to create the Vector by a member
> class myObject with column_name1 and column_name2
> fields and myVector.addElement(myObject).
>
> The resulting Vector is not "velocity-compliant" and
> the data cannot be retrived properly.
>
> How could I contruct a "velocity-compliant" Vector
> object that can be used to store query results and
> present the data just like $Entries in the sample
> app?
> Please help, Thanks in advance.
>
>
> Sincerely,
> Kenny
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> turbine-user-help@jakarta.apache.org
>
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org