Package guestbook;
Import java. SQL .*;
Public class guestbook {
String sDBDriver = "sun. jdbc. odbc. JdbcOdbcDriver ";
String sConnStr = "jdbc: odbc: guestbook ";
Connection conn = null;
ResultSet rs = null;
Public guestbook (){
Try {
Class. forName (sDBDriver );
}
Catch (java. lang. ClassNotFoundException e ){
System. err. println ("guestbook ():" + e. getMessage ());
}
}
Public void executeInsert (String SQL ){
Try {
Conn = DriverManager. getConnection (sConnStr );
Statement stmt = conn. createStatement ();
Stmt.exe cuteUpdate (SQL );
}
Catch (SQLException ex ){
System. err. println ("guestbook.exe cuteUpdate:" + ex. getMessage ());
}
}
Public ResultSet executeQuery (String SQL ){
Rs = null;
Try {
Conn = DriverManager. getConnection (sConnStr );
Statement stmt = conn. createStatement ();
Rs = stmt.exe cuteQuery (SQL );
}
Catch (SQLException ex ){
System. err. println ("guestbook.exe cuteQuery:" + ex. getMessage ());
}
Return rs;
}
}
<Html>
<Head>
<Title> My First Jsp GuestBook </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
</Head>
<Body bgcolor = "# CCCCFF" vlink = "#000000" alink = "#666666">
<Div align = "center">
<P> <font size = "7"> <B> <font size = "+ 6"> Jsp GuestBook </font> </B> </font> </p>
<Form method = "post" action = "index. jsp">
<Table width = "75%" align = "center" border = 1>
<Tr>
& Lt; td width = "30%" & gt;
<Div align = "right"> Name: </div>
</Td>
& Lt; td width = "70%" & gt;
<Input type = "text" name = "name">
</Td>
</Tr>
<Tr>