Home > Database > Mysql Tutorial > 如何使用JSP+MySQL创建留言本(二)_MySQL

如何使用JSP+MySQL创建留言本(二)_MySQL

WBOY
Release: 2016-06-01 14:09:03
Original
820 people have browsed it

有了数据库下面就要对数据库操作读取留言了!
下面列出显示留言的主要程序
import ="java.util.*"
import ="java.io.*"
contentType="text/html; charset=gb2312"
%>


萍慧自由空间留言本





萍慧自由空间留言本


bordercolordark="#6666FF" cellpadding="0" cellspacing="0" align="center">
  
  

String string_page;
int Page,RecoderPage,RecoderRow;
try{string_page=request.getParameter("page");
}catch (NullPointerException e){string_page="";}
try{Page=Integer.parseInt(string_page);
}catch(NumberFormatException e)
{Page=0;
}

java.sql.Connection sqlConn; //数据库连接对象
java.sql.Statement sqlStmt; //语句对象
java.sql.ResultSet sqlRst; //结果集对象
//登记JDBC驱动对象
Class.forName ("org.gjt.mm.mysql.Driver").newInstance ();
//连接数据库
sqlConn= java.sql.DriverManager.getConnection ("jdbc:mysql://localhost/p","test","");
//创建语句对象
sqlStmt=sqlConn.createStatement  
(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ONLY);
//执行Sql语句
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template