String nandu=request.getParameter("select");
if(nandu.equals("1")){
try{
String[] c=new String[999];//要使用数组的话一定要先定义
List<String> list = new ArrayList<String>();//新建列表
int i=0;
int a=1;
WorkDB t=new WorkDB();
t.setConnection();
t.setSql("select * from kdanxuan where kdanxuan_lv=1");
ResultSet rs=t.getResult();
while(rs.next()){
list.add(rs.getString(1)); //将取出的值存入列表
c[i]=rs.getString(1);//将值存入数组
i++;
}
String[] b = (String[])list.toArray(new String[0]);//将列表转化为数组
for(int j=0;j<=40;j++){
out.print(b[j]+" ");
out.print(c[j]+" ");//打印数组
}
}
catch(Exception e){}
}