预览加载中,请您耐心等待几秒...
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

亲,该文档总共17页,到这已经超出免费预览范围,如果喜欢就直接下载吧~

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

JSP分页查询关键代码 连接数据库的基类: packagecom.book.commons; importjava.sql.Connection; importjava.sql.DriverManager; importjava.sql.PreparedStatement; importjava.sql.ResultSet; importjava.sql.SQLException; publicclassGetConnection{ protectedConnectionconn=null;//连接字符串 protectedPreparedStatementps=null;//预编译并存储SQL指令 protectedResultSetrs=null;//查询结果集 privatestaticfinalStringDRIVER="com.microsoft.sqlserver.jdbc.SQLServerDriver";//加载数据库驱动的字符串 privatestaticfinalStringURL="jdbc:sqlserver://localhost:1433;databaseName=BOOKDB";//连接数据库的字符串 privatestaticfinalStringUSERNAME="sa";//数据库用户名 privatestaticfinalStringPASSWORD="accp";//数据库用户密码 /** *获得数据库连接 *@return */ publicConnectiongetConn(){ Connectionconn=null; try{ Class.forName(DRIVER);//加载数据库驱动 conn=DriverManager.getConnection(URL,USERNAME,PASSWORD);//连接数据库 }catch(ClassNotFoundExceptione){ //TODOAuto-generatedcatchblock e.printStackTrace(); }catch(SQLExceptione){ //TODOAuto-generatedcatchblock e.printStackTrace(); } returnconn; } /* *释放资源 */ publicvoidcloseAll(){ try{ if(rs!=null){ rs.close(); } if(ps!=null){ ps.close(); } if(conn!=null){ conn.close(); } }catch(SQLExceptione){ e.printStackTrace(); }finally{ conn=null; ps=null; rs=null; } } } 实体类代码: packagecom.book.entity; publicclassBook{ privateintbook_id; privateStringbook_name; privateStringbook_num; privateStringbook_author; privatedoublebook_price; privateStringbook_synopsis; privateStringbook_publishTime; publicStringgetBook_author(){ returnbook_author; } publicvoidsetBook_author(Stringbook_author){ this.book_author=book_author; } publicintgetBook_id(){ returnbook_id; } publicvoidsetBook_id(intbook_id){ this.book_id=book_id; } publicStringgetBook_name(){ returnbook_name; } publicvoidsetBook_name(Stringbook_name){ this.book_name=book_name; } publicStringgetBook_num(){ returnbook_num; } publicvoidsetBook_num(Stringbook_num){