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

数据插入问题
表单:
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN ">
<html>
    <head>
        <title> addStuInfo.html </title>

        <meta   http-equiv= "keywords "   content= "keyword1,keyword2,keyword3 ">
        <meta   http-equiv= "description "   content= "this   is   my   page ">
        <meta   http-equiv= "content-type "   content= "text/html;   charset=UTF-8 ">
       
        <!-- <link   rel= "stylesheet "   type= "text/css "   href= "./styles.css "> -->

    </head>
   
    <body>
      <div   align= "center "> <font   aize= "5 "> 新增学生记录 </font> </div>
      <hr   size= "1 ">
      <div   align= "center ">
      <form   action= "addStuInfo.jsp "   method= "post "   name= "form1 ">
      学号: <input   type= "text "   name= "sno "   size= "15 "> <br>
      姓名: <input   type= "text "   name= "sname "   size= "15 "> <br>
      性别: <input   type= "text "   name= "ssex "   size= "15 "> <br>
      年龄: <input   type= "text "   name= "sage "   size= "15 "> <br>
      籍贯: <input   type= "text "   name= "sjiguan "   size= "15 "> <br>
      <p> <input   type= "submit "   value= "提交 "> &nbsp;&nbsp;&nbsp; <input   type= "reset "   value= "重置 ">
    </form>  
    </body>
</html>

处理表单的jsp页面
<%@   page   language= "java "   import= "java.sql.* "   pageEncoding= "GB2312 "%>
<%
String   path   =   request.getContextPath();
String   basePath   =   request.getScheme()+ ":// "+request.getServerName()+ ": "+request.getServerPort()+path+ "/ ";
%>

<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN ">
<html>
    <head>
        <base   href= " <%=basePath%> ">
       
        <title> 处理增加的学生记录 </title>
       
<meta   http-equiv= "pragma "   content= "no-cache ">
<meta   http-equiv= "cache-control "   content= "no-cache ">
<meta   http-equiv= "expires "   content= "0 ">        
<meta   http-equiv= "keywords "   content= "keyword1,ke