public String[] search(){
List
String sql = "select name from user" ;
try {
conn = DBUtil.getConnection();//连接数据库的
ps = conn.prepareStatement(sql);
ResultSet rs= ps.executeQuery();
while(rs.next()){
list.add(rs.getString(1));
}
conn.commit();
} catch (SQLException e) {
e.printStackTrace();
return null ;
}catch(Exception e){
e.printStackTrace();
}finally{
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
String user[] = (String[])list.toArray(new String[list.size()]);
return user;
}
package com.declareol.trashbox;
import java.sql.ResultSet;
import java.util.Vector;
import com.declareol.commons.CommConnDataBase;
public class TrashBox {
public String[] strUser;
public void getTrashBox(String strName) {
CommConnDataBase CCDB = new CommConnDataBase();
ResultSet objRsInfo = null;
int intI = 0;
String strSelect = "select * from DOL_OFTEN_CASE";
List
try {
objRsInfo = CCDB.getResult(strSelect);
while (objRsInfo.next()) {
list.add(objRsInfo.getString(3));
intI++;
} catch (Exception e) {
System.out.print(e.getMessage());
} finally {
CCDB.Release();
}
}
public String[] putUser() {
return strUser;
}
}
javax.servlet.jsp.jstl这个包里有个ResultSupport