Is it possible that the rows are there but I just can't see them. When I run this, the header is collapsed to like 2 vertical pixels and no row area is shown. I tried setting the height on the box to 300px but it had no effect. I also tried eliminating the facet from the box, no effect.
John -----Original Message----- From: Bernd Bohmann [mailto:[EMAIL PROTECTED] Sent: Monday, March 06, 2006 2:39 PM To: MyFaces Discussion Subject: Re: Tobago sheet using jdbc ResultSet example request Have you played with my example? I can't see the problem maybe i have to setup a own example with your content but this takes some time. Good Night Bernd John schrieb: > Yes. I verified within the GetRslt() that there are rows being returned. > I did a System.out.println(rslt.getRow()) > > John > > -----Original Message----- > From: Bernd Bohmann [mailto:[EMAIL PROTECTED] > Sent: Monday, March 06, 2006 12:01 PM > To: MyFaces Discussion > Subject: Re: Tobago sheet using jdbc ResultSet example request > > Are you sure that getRslt() returns not null? > And can you check that the resultSet contains rows? > > John schrieb: > >>No change except no rows found is not reported. >> >> >> package com.pop3gateway; >> >>import com.pop3gateway.MessageObject.*; import java.util.HashMap; >>import java.util.*; import java.io.Serializable; import java.io.*; >>import java.sql.*; >> >>/** >> * <p>Title: Extensible Messaging Platform</p> >> * <p>Description: Enterprise Anti-spam Filter</p> >> * <p>Copyright: Copyright (c)1997-2004</p> >> * <p>Company: J.A. Korsmeyer, Inc.</p> >> * @author J.A. Korsmeyer, Inc. >> * @version 5.5 >> */ >> >>public class Quarantine extends DatabaseServer { >> //static final long serialVersionUID = -3537385394408850867L; >> //protected QuarantineRec QuarantineRec = null; >> protected boolean hit = false; >> protected boolean success = true; >> >> File messageFile = null; >> File messageFile2 = null; >> >> PreparedStatement stQuerySenderRecipient = null; PreparedStatement >> stQuerySender = null; PreparedStatement stQueryRecipient = null; >> PreparedStatement stQueryRecipientLike = null; PreparedStatement >> stInsertRec = null; PreparedStatement stDeleteRec = null; >> >> String quarantine = System.getProperty("EMP.home") + >>File.separatorChar + >> "Data" >> + File.separatorChar + "RouterProcessorEngines" + >>File.separatorChar >> + "0" + File.separatorChar + "Quarantine"; >> >> String msgObjs = System.getProperty("EMP.home") + File.separatorChar > > + > >> "Data" >> + File.separatorChar + "RouterProcessorEngines" + >>File.separatorChar >> + "0" + File.separatorChar + "MessageObjects"; >> >> public Quarantine() { >> this(System.getProperty("EMP.home") + File.separatorChar + "Db"); >> >> System.out.println("we ran the beans constructor"); >> //super(); >> } >> >> public Quarantine(String databaseDir) { >> super(databaseDir); >> System.out.println("We're ready to test if Quarantine tables >>exist"); >> if(!quarantineTablesExist()) { >> //System.out.println("They don't so create"); >> try { >> Statement createTableStatement = > > dbConnection.createStatement(); > >> System.err.println("create table statement"); >> Statement createIE1Statement = dbConnection.createStatement(); >> Statement createIE2Statement = dbConnection.createStatement(); >> System.err.println("create table"); >> createTableStatement.execute("CREATE CACHED TABLE >>quarantine(FILENAME CHAR(64), SENDER CHAR(128), RECIPIENT CHAR(128), >>SUBJECT CHAR(128), FILTEREDBY CHAR(24), MATCHTEXT CHAR(128), >>CONSTRAINT cQuarPRI PRIMARY KEY (FILENAME))"); >> createIE1Statement.execute("CREATE INDEX IEQ1 ON >>quarantine(SENDER)"); >> createIE2Statement.execute("CREATE INDEX IEQ2 ON >>quarantine(RECIPIENT)"); >> >> } >> catch (SQLException sqlCreateQuarantineE) { >> System.err.println("ERROR: unable to create table > > quarantine"); > >> sqlCreateQuarantineE.printStackTrace(); >> } >> } >> // prepare statements for later use >> initQuarantine(); >> >> } >> >>private String test = "beginning value"; >> private Object sheetState; >> private ResultSet rslt = null; >> boolean more = false; >> String returnSender = null; >> File dbDirPath = null; >> QuarantineRec quarantineRec = null; >> >> public void initQuarantine() { >> dbDirPath = new File(System.getProperty("EMP.home") + >>File.separatorChar + "Db"); >> //System.out.println("just entered init"); >> quarantineRec = new QuarantineRec(); >> >> try { >> setDatabaseDir(dbDirPath.getCanonicalPath()); >> dbConnect(); >> >> stQuerySenderRecipient = dbConnection.prepareStatement( >> "SELECT * FROM quarantine WHERE sender=? AND recipient=?", >> ResultSet.TYPE_SCROLL_INSENSITIVE, >> ResultSet.CONCUR_READ_ONLY); >> >> //System.out.println("just prepared > > stQuerySenderRecipient"); > >> stQuerySender = dbConnection.prepareStatement( >> "SELECT * FROM quarantine WHERE sender=?", >> ResultSet.TYPE_SCROLL_INSENSITIVE, >> ResultSet.CONCUR_READ_ONLY); >> //System.out.println("just prepared stQuerySender"); >> stQueryRecipient = dbConnection.prepareStatement( >> "SELECT * FROM quarantine WHERE recipient=?", >> ResultSet.TYPE_SCROLL_INSENSITIVE, >> ResultSet.CONCUR_READ_ONLY); >> stQueryRecipientLike = dbConnection.prepareStatement( >> "SELECT * FROM quarantine WHERE recipient LIKE ?", >> ResultSet.TYPE_SCROLL_INSENSITIVE, >> ResultSet.CONCUR_READ_ONLY); >> //System.out.println("just prepared stQueryRecipient"); >> stInsertRec = dbConnection.prepareStatement("INSERT INTO >>quarantine VALUES(?,?,?,?,?,?)"); >> stDeleteRec = dbConnection.prepareStatement("DELETE FROM >>quarantine WHERE filename = ?"); >> >> messagesList("[EMAIL PROTECTED]"); >> System.out.println("just called messagesList()"); >> >> } catch (SQLException stmtPrepE) { >> System.err.println("ERROR: Couldn't prepare statements"); >> } >> catch ( IOException dbPathE ) { >> System.err.println("ERROR: Couldn't find path to DB directory"); >> } >> >> >> } >> public boolean quarantined(String sender, String recipient) { >> hit = false; >> if( sender != null && recipient != null ) { >> try { >> stQuerySenderRecipient.setString(1, >>deFocus(sender).toLowerCase()); >> stQuerySenderRecipient.setString(2, recipient.toLowerCase()); >> rslt = stQuerySenderRecipient.executeQuery(); >> if (rslt != null && rslt.next()) { >> hit = true; >> } >> >> } >> catch (SQLException queryE) {} >> } >> return hit; >> } >> >> public boolean quarantined(SMTPMessageObject mo) { >> hit = false; >> if (mo.getSender() != null) { >> try { >> stQuerySender.setString(1, >>deFocus(mo.getSender().toLowerCase())); >> //System.out.println("getSender= " + deFocus(mo.getSender())); >> //System.out.println("recipientsString= " + >>mo.getRecipientsAsString()); >> rslt = stQuerySender.executeQuery(); >> >> if (rslt != null) more = rslt.next(); >> while (more && rslt != null) { >> //System.out.println("recipient=" + rslt.getString(2)); >> //System.out.println("recipString=" + >>mo.getRecipientsAsString()); >> if >>(mo.getRecipientsAsString().toLowerCase().indexOf(rslt.getString(2). >> toLowerCase()) > -1) { >> //System.out.println("matched"); >> hit = true; >> break; >> } >> more = rslt.next(); >> } >> >> } >> catch (SQLException queryE) {} >> } >> return hit; >> } >> >> public void messagesList(String recipient) { >> if( recipient != null ) { >> try { >> stQueryRecipientLike.setString(1, "%" + >>recipient.toLowerCase() >>+ "%"); >> >> rslt = stQueryRecipientLike.executeQuery(); >> System.out.println("result set=" + rslt); >> >> if(rslt.last()) { >> >> System.out.println("Number of records: " + rslt.getRow()); >> } else { >> System.out.println("No records returned"); >> >> } >> >> >> >> } catch (SQLException queryE) { queryE.printStackTrace(); } >> } >> >> } >> >> boolean tryAgain = true; >> public QuarantineRec getNextRec() { >> tryAgain = true; >> try { >> if( rslt != null && rslt.next() ) { >> >> while(tryAgain) { >> messageFile = new File(quarantine + File.separatorChar + >>rslt.getString("FILENAME")); >> if (messageFile.exists()) { >> //System.out.println("sender=" + rslt.getString(1)); >> quarantineRec.filename = rslt.getString("FILENAME"); >> quarantineRec.sender = rslt.getString("SENDER"); >> quarantineRec.recipient = >>truncate(rslt.getString("RECIPIENT"), 64); >> quarantineRec.subject = >>truncate(rslt.getString("SUBJECT"), >>64); >> quarantineRec.filteredby = rslt.getString("FILTEREDBY"); >> quarantineRec.matchtext = >>truncate(rslt.getString("MATCHTEXT"), 64); >> tryAgain = false; >> } >> else { >> deleteRec(rslt.getString("FILENAME")); // cleanup database > > >>record for deleted message >> if(! rslt.next()) { break; } >> } >> } >> } >> else { >> return null; >> } >> }catch (SQLException getNextE) {} >> return quarantineRec; >> } >> public String displayMessage(String filename) { >> String messageText = null; >> String tempLine; >> int lineNum = 0; >> >> try { >> BufferedReader bufMessageReader = new BufferedReader(new >>FileReader(quarantine + File.separatorChar + filename)); >> while( (tempLine = bufMessageReader.readLine()) != null ) { >> //System.out.println("(" + tempLine + ")"); >> messageText += tempLine + "\n"; >> lineNum++; >> if(lineNum > 100) { break; } >> >> } >> bufMessageReader.close(); >> >> } >> catch( Exception e) { >> e.printStackTrace(); >> } >> >> return messageText; >> } >> public boolean insertRec(String filename, String sender, String >>recipient, String subject, String filteredby, String matchtext) { >> success = false; >> if( sender != null && recipient != null ) { >> try { >> success = true; >> stInsertRec.setString(1, filename); >> stInsertRec.setString(2, deFocus(sender.toLowerCase())); >> stInsertRec.setString(3, recipient.toLowerCase()); >> stInsertRec.setString(4, subject); >> stInsertRec.setString(5, filteredby); >> stInsertRec.setString(6, matchtext); >> stInsertRec.execute(); >> } >> catch (SQLException insertE) {} >> } >> return success; >> } >> public boolean deleteRec(String filename) { >> try { >> success = true; >> stDeleteRec.setString(1, filename); >> stDeleteRec.execute(); >> // Delete from Quarantine directory >> >> messageFile = new File(quarantine + File.separatorChar + >>filename); >> if(messageFile.exists()) { >> messageFile.delete(); >> } >> >> } catch(SQLException deleteE) { success = false; } >> return success; >> >> } >> public boolean deliver(String filename) { >> boolean success = true; >> try { >> stDeleteRec.setString(1, filename); >> stDeleteRec.execute(); >> >> messageFile = new File(quarantine + File.separatorChar + >>filename); >> messageFile2 = new File(msgObjs + File.separatorChar + >>filename); >> >> messageFile.renameTo(messageFile2); >> } catch(SQLException deleteE) { success = false; } >> return success; >> } >> public boolean messageFileExists(String filename) { >> boolean exists = false; >> messageFile = new File(quarantine + File.separatorChar + > > filename); > >> if(messageFile.exists()) { exists = true; } >> return exists; >> } >> protected boolean quarantineTablesExist() { >> boolean exists = true; >> // String[] types = {"TABLE"}; >> try { >> Statement statement = dbConnection.createStatement(); >> ResultSet rs = statement.executeQuery("SELECT * FROM > > quarantine"); > >> /* >> DatabaseMetaData metaData = dbConnection.getMetaData(); >> ResultSet rs = metaData.getTables(null, null, "whitelist", // >>2nd null would be schemapattern >> null); >> if(rs.next()) { //the table exists >> exists = true; >> >> } >> */ >> }catch (Exception e) { e.printStackTrace(); exists = false; } >> return exists; >> >> } >> >> public void quarantineDirectoryCleanup() { >> // Delete from database if not in Quarantine directory >> // >> >> } >> public void close() { >> try { >> dbConnection.commit(); >> dbConnection.close(); >> } catch (SQLException sqlClose) { >> System.err.println("ERROR: closing connection into >>statistics database"); >> sqlClose.printStackTrace(); >> } >> } >> protected String deFocus(String str) { >> String returnToken = ""; // probably should be null but we need to > > >>fix in full path (SMTPmsgObject + output portal >> StringTokenizer tokenizer = new StringTokenizer(str, "<>"); >> if( tokenizer.hasMoreTokens()) { >> returnToken = tokenizer.nextToken(); >> } >> return returnToken; >> } >> >> public String truncate(String string, int maxChars) { >> String returnString = string; >> if(string != null && string.length() > maxChars) { >> returnString = string.substring(0, maxChars); >> } >> return returnString; >> } >> >> public ResultSet getRslt() { >> >> System.out.println("just called getRslt()"); >> return rslt; >> } >> public void setRslt(ResultSet rslt) { this.rslt = rslt; } >> >> //void getInitQuarantine() { initQuarantine(); } //void >> setInitQuarantine() { initQuarantine(); } >> >> public Object getSheetState() { >> return sheetState; >> } >> >> public void setSheetState(Object sheetState) { >> this.sheetState = sheetState; >> } >> >> public void setTest(String teststring) { >> this.test = teststring; >> System.out.println("just setTest to " + this.test); >> this.test = "this is what we hard setTest to"; } public String >>getTest() { return this.test; } } >> >>-----Original Message----- >>From: Bernd Bohmann [mailto:[EMAIL PROTECTED] >>Sent: Monday, March 06, 2006 11:27 AM >>To: MyFaces Discussion >>Subject: Re: Tobago sheet using jdbc ResultSet example request >> >>Please remove the state attribute it should be a ref to a SheetState >>Instance. >>Please remove showRowRage, showDirectLinks and directLinkCount >>attributes they make no sense for a dataModel for a resultSet because >>the dataModel returns rowCount -1 for a resultSet. >> >>Can you send me the ManagedBean code, please. >> >>Bernd >> >>John schrieb: >> >> >>>That's what I thought - so I changed it to uppercase. Didn't affect >>>the results. >>> >>>createTableStatement.execute("CREATE CACHED TABLE quarantine(FILENAME >>>CHAR(64), SENDER CHAR(128), RECIPIENT CHAR(128), SUBJECT CHAR(128), >>>FILTEREDBY CHAR(24), MATCHTEXT CHAR(128), CONSTRAINT cQuarPRI PRIMARY >>>KEY (FILENAME))"); >>> >>><t:sheet >>> value="#{quarantine.rslt}" >>> id="sheet" >>> columns="3*;1*;3*;3*;3*" >>> var="quarantineRec" >>> state="1" >>> showRowRange="left" >>> showPageRange="right" >>> showDirectLinks="center" >>> pagingLength="7" >>> directLinkCount="5"> >>> <t:column label="From" id="name" sortable="true"> >>> <t:out value="#{quarantineRec.SENDER}" /> >>> </t:column> >>> <t:column label="To" id="number" sortable="false" >>>align="center"> >>> <t:out value="#{quarantineRec.RECIPIENT}" /> >>> </t:column> >>> <t:column label="Subject" sortable="true"> >>> <t:out value="#{quarantineRec.SUBJECT}" /> >>> </t:column> >>> <t:column label="Matched" sortable="true"> >>> <t:out value="#{quarantineRecr.MATCHTEXT}" /> >>> </t:column> >>> <t:column label="Filtered" sortable="true" align="right"> >>> <t:out value="#{quarantineRec.FILTEREDBY}" /> >>> </t:column> >>> </t:sheet> >>> >>>-----Original Message----- >>>From: Bernd Bohmann [mailto:[EMAIL PROTECTED] >>>Sent: Monday, March 06, 2006 11:02 AM >>>To: MyFaces Discussion >>>Subject: Re: Tobago sheet using jdbc ResultSet example request >>> >>>John, >>> >>>please send the sheet jsp and the definition of the table. >>> >>>Maybe a case-sensitive problem. >>> >>>Bernd >>> >>>John schrieb: >>> >>> >>> >>>>Ok. >>>> >>>>My bean is retrieving 2 rows, but they are not being displayed. >>>> >>>>In the definition of the tobago sheet, the var definition: It's >>>>arbitrary, I'm assuming and doesn't map to any real variables in any >>>>beans. >>>>Ok. So assuming a var definition of: QuarantineRec Then in the >>>>t:outs >>> >>> >>>>if I'm using: quarantineRec.SENDER where SENDER is a database >>>>column >>> >>> >>>>in the returned ResultSet......... >>>> >>>>Does Tobago automatically know that SENDER is a db column? >>>> >>>>No data showing in the Tobago sheet. >>>> >>>>John >>>> >>>>-----Original Message----- >>>>From: Bernd Bohmann [mailto:[EMAIL PROTECTED] >>>>Sent: Monday, March 06, 2006 1:28 AM >>>>To: MyFaces Discussion >>>>Subject: Re: Tobago sheet using jdbc ResultSet example request >>>> >>>> >>>>John schrieb: >>>> >>>> >>>> >>>> >>>>>Thank you very much for the example. >>>>>The trick seems to be having a function called 'select' within the >>>>>backing bean, which tobago's sheet looks for to return data into >>>>>the > > >>>>>resultSet which has been provided within the sheet's value. >>>>> >>>>>Yes? >>>> >>>> >>>>No, the select method is for the detail page. >>>> >>>>The getSolarObjects() method is for the sheet. >>>> >>>>The other get methods are for the detail page. >>>> >>>> >>>>Bernd >>>> >>>> >>> >>> >>>-- >>>Dipl.-Ing. Bernd Bohmann - Atanion GmbH - Software Development >>>Bismarckstr. 13, 26122 Oldenburg, http://www.atanion.com >>>phone: +49 441 4082312, mobile: +49 173 8839471, fax: +49 441 4082333 >>> >>> >> >> >>-- >>Dipl.-Ing. Bernd Bohmann - Atanion GmbH - Software Development >>Bismarckstr. 13, 26122 Oldenburg, http://www.atanion.com >>phone: +49 441 4082312, mobile: +49 173 8839471, fax: +49 441 4082333 >> >> > > > -- > Dipl.-Ing. Bernd Bohmann - Atanion GmbH - Software Development > Bismarckstr. 13, 26122 Oldenburg, http://www.atanion.com > phone: +49 441 4082312, mobile: +49 173 8839471, fax: +49 441 4082333 > > -- Dipl.-Ing. Bernd Bohmann - Atanion GmbH - Software Development Bismarckstr. 13, 26122 Oldenburg, http://www.atanion.com phone: +49 441 4082312, mobile: +49 173 8839471, fax: +49 441 4082333

