1 package org.ashkelon.pages; 2 3 import org.ashkelon.*; 4 import org.ashkelon.db.*; 5 6 import java.util.*; 7 import java.sql.*; 8 9 12 public class StatsAuthors extends Page 13 { 14 public StatsAuthors() 15 { 16 super(); 17 } 18 19 public String handleRequest() throws SQLException 20 { 21 request.setAttribute("classCounts", getAuthorStats()); 22 return null; 23 } 24 25 private static int MAX_ROWS = 50; 26 27 public List getAuthorStats() throws SQLException 28 { 29 String sql = DBMgr.getInstance().getStatement("authorstats"); 30 31 Statement stmt = conn.createStatement(); 32 stmt.setMaxRows(MAX_ROWS); 33 36 ResultSet rset = stmt.executeQuery(sql); 37 38 List stats = new ArrayList(MAX_ROWS); 39 40 List info = null; 41 42 Author author = null; 43 while (rset.next()) 44 { 45 info = new ArrayList(2); 46 author = new Author(rset.getString(1)); 47 author.setId(rset.getInt(2)); 48 info.add(author); 49 info.add(rset.getString(3)); 50 stats.add(info); 51 } 52 53 return stats; 54 } 55 56 } 57 | Popular Tags |