Return-Path: Delivered-To: apmail-pivot-user-archive@www.apache.org Received: (qmail 82584 invoked from network); 8 May 2010 11:10:38 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 May 2010 11:10:38 -0000 Received: (qmail 34466 invoked by uid 500); 8 May 2010 11:10:38 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 34343 invoked by uid 500); 8 May 2010 11:10:37 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 34335 invoked by uid 99); 8 May 2010 11:10:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 May 2010 11:10:36 +0000 X-ASF-Spam-Status: No, hits=3.0 required=10.0 tests=FORGED_YAHOO_RCVD,FREEMAIL_FROM,SPF_HELO_PASS,SPF_NEUTRAL,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 May 2010 11:10:29 +0000 Received: from ben.nabble.com ([192.168.236.152]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1OAhv6-0003mF-NJ for user@pivot.apache.org; Sat, 08 May 2010 04:10:08 -0700 Date: Sat, 8 May 2010 04:10:08 -0700 (PDT) From: GB To: user@pivot.apache.org Message-ID: <1273317008715-785464.post@n3.nabble.com> Subject: Display Bean Data In Table View MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Friends, I have successfully completed one way trip from User To Database. I now just want to display the ResultSet data. I did not find relevant examples on the web/this-forum - hence this post. The application has the following architecture: A bean named "Expense" with properties expenseId, expenseDate, expenseDescription, expenseType, remarks, amount - with the relevant getters/setters. A DB class that connects to the Oracle DB and fetches the expenses. The relevant code is : package rams.db; public class DB { org.apache.pivot.collections.ArrayList expenseList = new ArrayList(); BeanDictionary bd;// = new BeanDictionary(); rams.entity.Expense expense; public ArrayList showExpenses() { Connection conn = null; PreparedStatement pstmt = null; String selectExpenseSql = "Select * from P_Expense"; //java.util.ArrayList expenseList = new ArrayList(); try { conn = getOracleJDBCConnection(); } catch (Exception e) { System.out.println("Exception Getting DB Connection ::: " + e); } try { pstmt = conn.prepareStatement(selectExpenseSql); pstmt.setFetchSize(10); //run the sql on the table ResultSet rs = pstmt.executeQuery(); while(rs.next()) { int expenseId = rs.getInt("EXPENSEID"); java.sql.Date expenseDate = rs.getDate("EXPENSEDATE"); String expenseDescription = rs.getString("EXPENSEDESCRIPTION"); String expenseType = rs.getString("EXPENSETYPE"); String remarks = rs.getString("REMARKS"); double amount = rs.getDouble("AMOUNT"); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); String expdate = df.format(expenseDate); String amount_str = Double.toString(amount); String expenseId_str = String.valueOf(expenseId); expense = new Expense(expenseId_str, expenseType, expenseDescription, expenseType, remarks, amount_str); System.out.println("Created an instance of Expense Object"); bd = new BeanDictionary(expense); System.out.println("Wrapped the instance of Expense Object in BeanDictionary"); expenseList.add(bd); System.out.println("Expense Added To The ExpenseList"); } System.out.println("Completed Expense ResultSet Processing"); } return expenseList; } } The wtkx file: So my question is: How do I specify the tableData? Question-1: In this particular case, the data is available in instances of Expensse bean wrapped in Pivot Collections ArrayList. [One Expense bean instance per record/row] Question-2: In another case, if the data is made available in a JSON list how do I specify? The example in the pivot site gives this format for a file that is physically present in a location: tableData="@standings.json" However if I convert the resultset into JSON format, how do I specify in the wtkx file? Any help to resolve this would be of immense help to me. Thanks in Advance. GB -- View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Display-Bean-Data-In-Table-View-tp785464p785464.html Sent from the Apache Pivot - Users mailing list archive at Nabble.com.