日期:2014-05-18  浏览次数:20774 次

救命啊,实在找不出来错误在哪儿
jsp页面是这样的:

<%@   page   contentType= "text/html;   charset=gb2312 "   language= "java "   errorPage= " "   %>
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN "   "http://www.w3.org/TR/html4/loose.dtd ">
<jsp:useBean   id= "db "   scope= "page "   class= "database.sqlBean "/>

<%
String   id=(String)request.getAttribute( "id ");
String   name=(String)request.getAttribute( "name ");
if(id!= " "&&name!= " ")
{
String   sqlStr= "insert   into   examinees   values( '343534 ', 'dukeduke ', '8888 ') ";
db.setConnection( "sun.jdbc.odbc.JdbcOdbcDriver ", "jdbc:odbc:exam ", "sa ", " ");
db.setStatement(sqlStr);
db.update();
db.disConnect();
}
%>


<script   language= "JavaScript ">
function   check()
{
if(document.form1.id.value== " ")
{
alert( "请输入考生号码 ");
document.form1.id.focus();
return   false;
}
else   if(document.form1.name.value== " ")
{
alert( "请输入考生姓名 ");
document.form1.name.focus();
return   false;
}
}
</script>


<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> </title>
</head>
<body>
<div   align= "right "> <a   href= "examinee_list.jsp "   > <strong> 考生列表 </strong> </a>   &nbsp;
<a   href= "examinee_add.jsp "> <strong> 新增考生 </strong> </a> </div> <p>
<form   name= "form1 "   onSubmit= "return   check(); "   method= "post ">
    <table   width= "50% "     border= "1 "   cellpadding= "1 "   cellspacing= "2 "   bgcolor= "#66FFFF ">
        <tr>
            <td     bgcolor= "#0066FF "   scope= "col "> 考生号码: </td>
            <td   scope= "col "> <input   type= "text "   name= "id "> </td>
        </tr>
        <tr>
            <td     bgcolor= "#0066FF "> 考生姓名: </td>
            <td> <input   type= "text "   name= "name "> </td>
        </tr>
<tr>
            <td   align= "center "     bgcolor= "#0066FF "> <input   type= "submit "     value= "添加 "   > </td>
            <td   align= "center "> <input   type= "reset "