You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Thomas F. Lavery" <la...@genome.wi.mit.edu> on 2001/05/22 05:01:49 UTC

ResultSet question

Hi y'all, 

If I don't want to put a ResultSet into the Velocity context, what's the
best way to put the ResultSet data into the context (this also applies to
beans returning ResultSet data to a jsp)?  Should I iterate through the
ResultSet data and put everything into a Vector object first (or
something similar)?  

Thanks,
Thomas Lavery




RE: requirements

Posted by Jorge De Flon <ja...@yahoo.com>.
Thank you for the info, I has solved several doubts.
Regards,
Jorge


----- Original Message -----
From: Geir Magnusson Jr. <gm...@xyris.com>
To: <ve...@jakarta.apache.org>
Sent: Thursday, May 24, 2001 2:36 PM
Subject: Re: requirements


> From: "Jorge De Flon" <ja...@yahoo.com>
>
>
> > Hi,
> >
> > I cant find the minumal requierements for velocity in de documentation.
> > Does it run in a servlet 2.0 container or it requieres 2.1 servlet
> > container?
> >
>
> Technically speaking, Velocity is just a template engine ;) and doesn't
> *require* a servlet container.
>
> That said, we do provide a servlet base class called VelocityServlet that
> helps integrating Velocity into your web/servlet development easier.
>
> Take a look at that to see the kind of support that it offers.  Since most
> of the method that would be important to you, namly init and
> loadConfiguration() are aimed more towards a 2.2 environment, you might
> simply want to override init(), do you own Velocity configuration, and
then
> simply take advange of the writer pooling that VelocityServlet offers.
>
> If I remember right, people have used it successfully in a servlet 2.0
> container.  However, a 2.2 container like Tomcat 3.2 or any number of
other
> implementations are recommended.
>
> geir
>
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: requirements

Posted by "Geir Magnusson Jr." <gm...@xyris.com>.
From: "Jorge De Flon" <ja...@yahoo.com>


> Hi,
>
> I cant find the minumal requierements for velocity in de documentation.
> Does it run in a servlet 2.0 container or it requieres 2.1 servlet
> container?
>

Technically speaking, Velocity is just a template engine ;) and doesn't
*require* a servlet container.

That said, we do provide a servlet base class called VelocityServlet that
helps integrating Velocity into your web/servlet development easier.

Take a look at that to see the kind of support that it offers.  Since most
of the method that would be important to you, namly init and
loadConfiguration() are aimed more towards a 2.2 environment, you might
simply want to override init(), do you own Velocity configuration, and then
simply take advange of the writer pooling that VelocityServlet offers.

If I remember right, people have used it successfully in a servlet 2.0
container.  However, a 2.2 container like Tomcat 3.2 or any number of other
implementations are recommended.

geir




requirements

Posted by Jorge De Flon <ja...@yahoo.com>.
Hi,

I cant find the minumal requierements for velocity in de documentation.
Does it run in a servlet 2.0 container or it requieres 2.1 servlet
container?

thanks


----- Original Message -----
From: Geir Magnusson Jr. <ge...@optonline.net>
To: <ve...@jakarta.apache.org>
Sent: Monday, May 21, 2001 10:41 PM
Subject: Re: ResultSet question


> Jon Stevens wrote:
> >
> > on 5/21/01 8:29 PM, "Jorge De Flon" <ja...@yahoo.com> wrote:
> >
> > > What if you have a huge resultset?
> > > whatdo you recommend.
> > > I Know that it is a design frequent problem, but i would like your
opinion,
> > > because with velocity (or any division of labour) it it more critical.
> > >
> > > Thanks
> >
> > Most of the time, you aren't going to have a huge result set. It is a
bad
> > design to have one that is large because then you are sending back a ton
of
> > stuff to the user. Instead, what you should do is limit the result set
size
> > and display <previous> <next> buttons on the page so that the user can
> > scroll through the result set...much like google.com returns results...
> >
> > -jon
>
> +1
>
> Exactly.   Also, it wanks the server pretty good to move everything over
> the wire to the servlet from the db, keep it in memory in the servlet
> box, etc.
>
> I guess if you *must* do it, like if there is some calculation you can't
> make the db engine do for you, then I guess you have to :)
>
> geir
>
> --
> Geir Magnusson Jr.                           geirm@optonline.net
> System and Software Consulting
> Developing for the web?  See http://jakarta.apache.org/velocity/
> "still climbing up to the shoulders..."


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: ResultSet question

Posted by Tim Joyce <ti...@hoop.co.uk>.
> What if I don't want to use (or not allowed to use) torque?

http://www.melati.org

> > > What if you have a huge resultset?

1)  cache it
2)  page it
3)  get it lazily - don't load up the results set into (eg) a Vector, rather
get each record as you #foreach in your template.

POEM (Persistant Object Engine for Melati) will handle this lot for you
@see
http://www.paneris.org/cgi-bin/cvsweb.cgi/org/melati/util/DumbPageEnumeratio
n.java?rev=1.13&content-type=text/x-cvsweb-markup

cheers

timj





RE: ResultSet question

Posted by Jorge De Flon <ja...@yahoo.com>.
Thanks for all of your opinions.


----- Original Message -----
From: Geir Magnusson Jr. <ge...@optonline.net>
To: <ve...@jakarta.apache.org>
Sent: Monday, May 21, 2001 10:41 PM
Subject: Re: ResultSet question


> Jon Stevens wrote:
> >
> > on 5/21/01 8:29 PM, "Jorge De Flon" <ja...@yahoo.com> wrote:
> >
> > > What if you have a huge resultset?
> > > whatdo you recommend.
> > > I Know that it is a design frequent problem, but i would like your
opinion,
> > > because with velocity (or any division of labour) it it more critical.
> > >
> > > Thanks
> >
> > Most of the time, you aren't going to have a huge result set. It is a
bad
> > design to have one that is large because then you are sending back a ton
of
> > stuff to the user. Instead, what you should do is limit the result set
size
> > and display <previous> <next> buttons on the page so that the user can
> > scroll through the result set...much like google.com returns results...
> >
> > -jon
>
> +1
>
> Exactly.   Also, it wanks the server pretty good to move everything over
> the wire to the servlet from the db, keep it in memory in the servlet
> box, etc.
>
> I guess if you *must* do it, like if there is some calculation you can't
> make the db engine do for you, then I guess you have to :)
>
> geir
>
> --
> Geir Magnusson Jr.                           geirm@optonline.net
> System and Software Consulting
> Developing for the web?  See http://jakarta.apache.org/velocity/
> "still climbing up to the shoulders..."


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: ResultSet question

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Jon Stevens wrote:
> 
> on 5/21/01 8:29 PM, "Jorge De Flon" <ja...@yahoo.com> wrote:
> 
> > What if you have a huge resultset?
> > whatdo you recommend.
> > I Know that it is a design frequent problem, but i would like your opinion,
> > because with velocity (or any division of labour) it it more critical.
> >
> > Thanks
> 
> Most of the time, you aren't going to have a huge result set. It is a bad
> design to have one that is large because then you are sending back a ton of
> stuff to the user. Instead, what you should do is limit the result set size
> and display <previous> <next> buttons on the page so that the user can
> scroll through the result set...much like google.com returns results...
> 
> -jon

+1

Exactly.   Also, it wanks the server pretty good to move everything over
the wire to the servlet from the db, keep it in memory in the servlet
box, etc.

I guess if you *must* do it, like if there is some calculation you can't
make the db engine do for you, then I guess you have to :)

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."

Re: ResultSet question

Posted by Jon Stevens <jo...@latchkey.com>.
on 5/21/01 8:29 PM, "Jorge De Flon" <ja...@yahoo.com> wrote:

> What if you have a huge resultset?
> whatdo you recommend.
> I Know that it is a design frequent problem, but i would like your opinion,
> because with velocity (or any division of labour) it it more critical.
> 
> Thanks

Most of the time, you aren't going to have a huge result set. It is a bad
design to have one that is large because then you are sending back a ton of
stuff to the user. Instead, what you should do is limit the result set size
and display <previous> <next> buttons on the page so that the user can
scroll through the result set...much like google.com returns results...

-jon


RE: ResultSet question

Posted by Jorge De Flon <ja...@yahoo.com>.
What if you have a huge resultset?
whatdo you recommend.
I Know that it is a design frequent problem, but i would like your opinion,
because with velocity (or any division of labour) it it more critical.

Thanks

----- Original Message -----
From: Geir Magnusson Jr. <ge...@optonline.net>
To: <ve...@jakarta.apache.org>
Sent: Monday, May 21, 2001 10:18 PM
Subject: Re: ResultSet question


> "Thomas F. Lavery" wrote:
> >
> > Hi y'all,
> >
> > If I don't want to put a ResultSet into the Velocity context, what's the
> > best way to put the ResultSet data into the context (this also applies
to
> > beans returning ResultSet data to a jsp)?  Should I iterate through the
> > ResultSet data and put everything into a Vector object first (or
> > something similar)?
>
> That's what I do, but I generally have small result sets by design
>
> Some people make little wrappers to access...
>
> --
> Geir Magnusson Jr.                           geirm@optonline.net
> System and Software Consulting
> Developing for the web?  See http://jakarta.apache.org/velocity/
> "still climbing up to the shoulders..."


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: ResultSet question

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
"Thomas F. Lavery" wrote:
> 
> Hi y'all,
> 
> If I don't want to put a ResultSet into the Velocity context, what's the
> best way to put the ResultSet data into the context (this also applies to
> beans returning ResultSet data to a jsp)?  Should I iterate through the
> ResultSet data and put everything into a Vector object first (or
> something similar)?

That's what I do, but I generally have small result sets by design

Some people make little wrappers to access...

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."

Re: ResultSet question

Posted by Jon Stevens <jo...@latchkey.com>.
on 5/21/01 8:26 PM, "Thomas F. Lavery" <la...@genome.wi.mit.edu> wrote:

> What if I don't want to use (or not allowed to use) torque?

Then you get to re-invent the wheel.

-jon


Re: ResultSet question

Posted by "Thomas F. Lavery" <la...@genome.wi.mit.edu>.
What if I don't want to use (or not allowed to use) torque?  

> on 5/21/01 8:01 PM, "Thomas F. Lavery" <la...@genome.wi.mit.edu> wrote:
> 
> > Hi y'all, 
> > 
> > If I don't want to put a ResultSet into the Velocity context, what's the
> > best way to put the ResultSet data into the context (this also applies to
> > beans returning ResultSet data to a jsp)?  Should I iterate through the
> > ResultSet data and put everything into a Vector object first (or
> > something similar)?
> > 
> > Thanks,
> > Thomas Lavery
> 
> <http://jakarta.apache.org/turbine/howto/torque-howto.html>
> 
> -jon
> 
> -- 
> If you come from a Perl or PHP background, JSP is a way to take
> your pain to new levels. --Anonymous
> <http://jakarta.apache.org/velocity/ymtd/ymtd.html>
> 
> 


Re: ResultSet question

Posted by Jon Stevens <jo...@latchkey.com>.
on 5/21/01 8:01 PM, "Thomas F. Lavery" <la...@genome.wi.mit.edu> wrote:

> Hi y'all, 
> 
> If I don't want to put a ResultSet into the Velocity context, what's the
> best way to put the ResultSet data into the context (this also applies to
> beans returning ResultSet data to a jsp)?  Should I iterate through the
> ResultSet data and put everything into a Vector object first (or
> something similar)?
> 
> Thanks,
> Thomas Lavery

<http://jakarta.apache.org/turbine/howto/torque-howto.html>

-jon

-- 
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
<http://jakarta.apache.org/velocity/ymtd/ymtd.html>