JSP哪个预编译的还是不行啊.............

来源:百度知道 编辑:UC知道 时间:2024/06/15 07:21:21
jsp文件-----------------------------------

<%@ page import="java.sql.*" %>
<%@ page contentType="text/html;charset=GB2312" %>

<%
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String url = "jdbc:odbc:cs";

try
{
Class.forName(driver);
}
catch(Exception e)
{
e.printStackTrace();
}

try
{

Connection con = DriverManager.getConnection(url);
PreparedStatement psmt = con.prepareStatement("UPDATE worker"
+"set phone='?',addr='?'"
+"where name='?'");

psmt.setString(1,"1234567");
psmt.setString(2,"Beijing");
psmt.setString(3,"1");
psmt.executeUpdate();

psmt.close();
con.close();

}
catch(Exception e)
{
e

<%@ page import="java.sql.*" %>
<%@ page contentType="text/html;charset=GB2312" %>

<%
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String url = "jdbc:odbc:cs";

try
{
Class.forName(driver);
}
catch(Exception e1)
{
e1.printStackTrace();
}

try
{

Connection con = DriverManager.getConnection(url);
PreparedStatement psmt = con.prepareStatement("UPDATE worker"
+"set phone='?',addr='?'"
+"where name='?'");

psmt.setString(1,"1234567");
psmt.setString(2,"Beijing");
psmt.setString(3,"1");
psmt.executeUpdate();

psmt.close();
con.close();

}
catch(Exception e)
{
out.print(e.toString());
e.printStackTra