是什么意思呀?
newtushu.jsp
<%@page contentType="text/html;charset=GB2312"%>
<%@page import="java.sql.*"%>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<html>
<body bgcolor=cyan>
<font size=2>
添加新的数据到数据库:
<form action="newresult.jsp" method=post>
图书名:<br>
<input type="text" name="name" >
<br>编号:<br>
<input type="text" name="bianhao">
<br>出版社名:<br>
<input type="text" name="chubanshe">
<br>作者:<br>
<input type="text" name="zuozhe">
<br>类别:<br>
<input type="text" name="leibie">
<br>
<input type="submit" name="submit" value="提交添加">
<p>添加前的记录是:
<%
String name,bianhao,chubanshe,zuozhe,leibie;
Connection con;
Statement sql;
ResultSet rs;
String str="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\datafile\\tushu1.mdb";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){}
try
{
con=DriverManager.getConnection(str,"","");
sql=con.createStatement();
rs=sql.executeQuery("Select * From tushu2");
out.print("<Table Border>");
out.print("<TR>");
out.print("<TH width=100>"+"编号");
out.print("<TH width=100>"+"图书名");
out.print("<TH width=100>"+"作者");
out.print("<TH width=100>"+"出版社名");
out.print("<TH width=100>"+"类别");
out.print("</TR>");
while(rs.next())
{
out.print("<TR>");
bianhao=rs.getString("编号");
out.print("<TD>"+bianhao+"</TD>");
name=rs.getString("图书名");
out.print("<TD>"+name+"</TD>");
zuozhe=rs.getString("作者");
out.print("<TD>"+zuozhe+"</TD>");
chubanshe=rs.getString("出版社名");
out.print("<TD>"+chubanshe+"</TD>");
leibie=rs.getString("类别");
out.print("<TD>"+leibie+"</TD>");
out.print("</TR>");
}
out.print("</Table>");
rs.close();
sql.close();
con.close();
;
}
catch(SQLException e1){}
%>
</form>
</font>
</body>
</html>