1、我的采用的是javabena+jsp。一个javabean。public ArrayList selectCourseInfo()throws Exception {//下拉框显示课程信息ArrayList list = new ArrayList()。
2、try {db.open();ResultSet rs = db.select("select * from CourseInfo");while 烫喇霰嘴(rs.next()) {list.add(new CourseInfo(rs.getInt(1), rs.getString(2),rs.getString(3)))。
3、}} catch (Exception e) {e.printStackTrace();} finally {db.close();}return list。
4、}然后在jsp中调用<tr><td>课 程:<select name="course"><%try{ArrayList list=m.selectCourseInfo();if(list.isEmpty()){out.println("没有数据显示")。
5、}for(int i=0;i<list.size();坡纠课柩i++){CourseInfo c=(CourseInf泠贾高框o)list.get(i);%><option><%=c.getName()%></option><%}}catch(Exception e){}%></select></td></tr>这样就可以动态的显示了。