JSP实现下拉框的内容显示的是数据库中的数据

  
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="javabean.book"%>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="javabean.*" %>







<%
   List list=new ArrayList();
   Connection con=null;
   ResultSet rs=null;
   Statement stmt=null;
   con=DBUtil.getDb();
   String sql="select book_publish from book_info";
   stmt=con.createStatement();
   try{
	  rs=stmt.executeQuery(sql) ;
	  while(rs.next()){
		 
		  list.add(rs.getString("book_publish"));	  
		  
	  }   
   }catch(SQLException ex){
	   System.out.println(ex.getMessage());
   }
%>






你可能感兴趣的:(java,web)