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:50:35 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());
+    DAS das = DAS.FACTORY.createDAS(getConnection());
-         // Build command to read all customers
+    // Build command to read all customers
-         Command custCommand = das.createCommand("select * from CUSTOMER order by ID");
+    Command custCommand = das.createCommand("select * from CUSTOMER order by ID");
  
-         // Create a pager with the command
+    // Create a pager with the command
-         Pager pager = new PagerImpl(custCommand, 2);
+    Pager pager = new PagerImpl(custCommand, 2);
  
-         // Get and work with first page
+    // Get and work with first page
-         DataObject root = pager.next();
+    DataObject root = pager.next();
-         DataObject customer1 = root.getDataObject("CUSTOMER[1]");
+    DataObject customer1 = root.getDataObject("CUSTOMER[1]");
-         DataObject customer2 = root.getDataObject("CUSTOMER[2]");
+    DataObject customer2 = root.getDataObject("CUSTOMER[2]");
  
-         // Get and work with the second page
+    // Get and work with the second page
-         root = pager.next();
+    root = pager.next();
-         customer1 = root.getDataObject("CUSTOMER[1]");
+    customer1 = root.getDataObject("CUSTOMER[1]");
-         customer2 = root.getDataObject("CUSTOMER[2]");
+    customer2 = root.getDataObject("CUSTOMER[2]");
  
-         // First page again
+    // First page again
-         root = pager.previous();
+    root = pager.previous();
-         customer1 = root.getDataObject("CUSTOMER[1]");
+    customer1 = root.getDataObject("CUSTOMER[1]");
-         customer2 = root.getDataObject("CUSTOMER[2]");
+    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