You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Inandjo Taurel <in...@hotmail.com> on 2003/09/13 15:53:21 UTC

how to write a pager in velocity??

hi,

am trying to write a pager in velocity screens so as to have my screens 
displays only a defined number of rows on the screen, and then be able to go 
to the next set of result set and the previous, just by clicking the link.
How can i achieve that in the context of velocity?

PS: am using TDK 2.1 with jdk1.3.1..

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail


how to write a pager in velocity??

Posted by Matt Hughes <mh...@uvic.ca>.
Inandjo Taurel writes:
 > hi,
 > 
 > am trying to write a pager in velocity screens so as to have my screens 
 > displays only a defined number of rows on the screen, and then be able to go 
You can either use Criteria objects to set a limit and offset for the
rows you are returning, and make two queries; one for the actual data
and one for the number of total rows. Then you can do some math given
how many rows you want to display on a page and generate links that
have the offset and limit as parameters. 

A better way may be the org.apache.torque.util.LargeSelect object
(http://db.apache.org/torque/apidocs/org/apache/torque/util/LargeSelect.html),
although I have not used it... the page above shows a bit of Velocity
code for getting some records out of a LargeSelect object. 

The LargeSelect object would itself be constructed in a Screen class,
after testing for it's existance in the Session or User object. 

 > to the next set of result set and the previous, just by clicking the link.
 > How can i achieve that in the context of velocity?
 > 
 > PS: am using TDK 2.1 with jdk1.3.1..
 > 
 > _________________________________________________________________
 > Add photos to your messages with MSN 8. Get 2 months FREE*. 
 > http://join.msn.com/?page=features/featuredemail
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
 > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
 > 

-- 
 Matt Hughes
  + mhughe@uvic.ca
  + http://susurrous.net/
  + "Were there monkeys? Some terrifying space monkeys maybe got loose?"