Statement stmt = con.createStatement();
String operation;
operation="SELECT time,who,comment,filename FROM `revisionhistory` WHERE stack_level=0 ORDER BY stack_level DESC,filename LIMIT 0 , 30";
// p("...in MainWindow: "+operation);
ResultSet rs = stmt.executeQuery(operation);
Listbox listbox=null;
if(target.equals("open"))
listbox = (Listbox)Path.getComponent("//p2/mainWin/fileOpenViewWin/flo_files");
if(target.equals("delete"))
listbox = (Listbox)Path.getComponent("//p2/mainWin/fileDeleteWin/fld_files");
if(target.equals("export"))
listbox = (Listbox)Path.getComponent("//p2/mainWin/fileExportWin/fle_files");
List childList = listbox.getChildren();
//remain the list head component
while(childList.size()>1)
listbox.removeChild((Component)childList.get(1));
while(rs.next()){
//System.out.println("in rs.next");
Listitem newListItem = new Listitem();
Date date = rs.getDate("time");
SimpleDateFormat sdf=new SimpleDateFormat("M/dd h");
newListItem.appendChild(new Listcell(rs.getString("filename")));
newListItem.appendChild(new Listcell(rs.getString("who")));
newListItem.appendChild(new Listcell(String.valueOf(sdf.format(date))));
listbox.appendChild(newListItem);
}
//close the jdbc connection
stmt.close();
con.close();
listbox.setSelectedIndex(0);
}
catch (SQLException ex)
{
System.out.println("exception: "+ex.getMessage());
System.out.println("SQLState: "+ex.getSQLState());