ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Ws Wiki] Update of "WorkingWithPaging" by KevinWilliams
Date Mon, 30 Oct 2006 18:48:55 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change notification.

The following page has been changed by KevinWilliams:
http://wiki.apache.org/ws/WorkingWithPaging

------------------------------------------------------------------------------
  }
  }}}
  
+ A Pager is instantiated on a given read Command and the constructor is used to specify the
desired page size (number of dataase rows per page).  The following example illustrates constrution
and use of a pager:
+ {{{
+         DAS das = DAS.FACTORY.createDAS(getConnection());
+         // Build command to read all customers
+         Command custCommand = das.createCommand("select * from CUSTOMER order by ID");
+ 
+         // Create a pager with the command
+         Pager pager = new PagerImpl(custCommand, 2);
+ 
+         // Get and work with first page
+         DataObject root = pager.next();
+         DataObject customer1 = root.getDataObject("CUSTOMER[1]");
+         DataObject customer2 = root.getDataObject("CUSTOMER[2]");
+ 
+         // Get and work with the second page
+         root = pager.next();
+         customer1 = root.getDataObject("CUSTOMER[1]");
+         customer2 = root.getDataObject("CUSTOMER[2]");
+ 
+         // First page again
+         root = pager.previous();
+         customer1 = root.getDataObject("CUSTOMER[1]");
+         customer2 = root.getDataObject("CUSTOMER[2]");
+ 
+ }}}
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@ws.apache.org
For additional commands, e-mail: general-help@ws.apache.org


Mime
View raw message