看错误信息是编译成servlet语发错误,楼主能把你的全部的代码贴出来吗?特别是Finally那一块的

解决方案 »

  1.   

    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>大学生求职信息网</title></title><link href="file:///F|/compzhuye.files/css.css" type=text/css rel=stylesheet>
    </head><body>
    <%
       String id=request.getParameter("stid");
       String psw=request.getParameter("stpassword");
       String name=request.getParameter("stname");
       String card=request.getParameter("stshenfenhaoma");
       String sex=request.getParameter("stsex");
       String address=request.getParameter("stjiguan");
       String brithday=request.getParameter("stage");
       String profession=request.getParameter("stsp");
       String school=request.getParameter("stschool");
       String xueli=request.getParameter("stxueli");
       String tel=request.getParameter("sttel");
       String e_mail=request.getParameter("stemail");
       String english=request.getParameter("stenglish");
       String compter=request.getParameter("stcompt");
       String height=request.getParameter("sttall");
       String qiuzhi=request.getParameter("stqiuzhi");
       String introduce=request.getParameter("stjieshao");
       
       
       Connection con = null;
       Statement sql = null;
       ResultSet rs = null;
       try {
           Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       }
       catch(ClassNotFoundException event){}
       try{
       con=DriverManager.getConnection("jdbc:odbc:moon","sa","");
       sql=con.createStatement();
       String infor = ("INSERT INTO stinfor(stid,stpassword,stname,stcardnumber,stsex,staddress,stage,stprofession,stschool,stxueli,sttel,stemail,stenglish,stcompt,sttall,stqiuzhi,stjieshao) VALUES('"+
                    id+"','"+psw+"','"+name+"','"+card+"','"+
                    sex+"','"+address+"','"+brithday+"','"+profession+"','"+
                    school+"','"+xueli+"','"+tel+"','"+e-mail+"','"+english+"','"+compter+"','"+height+"','"+qiuzhi+"','"+intriduce+"')");
       sql.executeUpdate(infor);
       }finally{
       rs.close();
       sql.close();
       con.close();
       }
      
    %>
    <div align="center"><table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="1" bgcolor="#ADADAD"></td>
        <td>
    </table>     
         
    <table width="776" border="0" cellspacing="0" cellpadding="0">
            <tr> 
              <td width="199" rowspan="2"><img src="file:///F|/qz_imags/logo.gif" width="200" height="65" border="0" usemap="#Map"></td>
              <td width="577" height="38" align="center" valign="middle" background="file:///F|/qz_imags/d_01.gif">
        <table width="80%" border="0" cellpadding="0" cellspacing="3">
                  <tr> 
                    <td width="194" height="18" valign="middle"> <div align="left"><font color="#FF0000"><%=request.getParameter("stname")%></font> 
                        您好!欢迎光临</div></td>
                    <td width="185"><%=getDate%></td>
                   
                  </tr>
                </table>
           
            <tr> 
              <td height="27" align="center" valign="bottom" background="file:///F|/qz_imags/d_02.gif">
        <table width="75%" border="0" cellspacing="0" cellpadding="0">
                  <tr align="center"> 
                    <td><a href="file:///F|/stzhuce.jsp" ><img src="file:///F|/qz_imags/en_01.gif" width="81" height="15" border="0"></a></td>
                    <td><img src="file:///F|/qz_imags/en_00.gif" width="5" height="16"></td>
                   
                  </tr>
                </table>
    </table>
    <map name="Map2">
      <area shape="rect" coords="25,2,167,41" href="http://大学生求职信息网">
      <area shape="rect" coords="35,46,163,62" href="file:///F|/index.jsp">
    </map>
    <map name="Map">
      <area shape="rect" coords="24,2,169,41" href="http://大学生求职信息网">
      <area shape="rect" coords="36,46,159,58" href="file:///F|/index.jsp">
    </map>
    </body>
    </html>
    </div>  
    <table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr> 
        <td width="1" rowspan="3" bgcolor="adadad"></td>
        <td width="776" align="center"><br><img src="file:///F|/qz_imags/grjlzc.gif" width="154" height="27"><br><br></td>
        <td width="1" rowspan="3" bgcolor="adadad"></td>
      </tr>
      <tr> 
        <td align="center"> 
          <table width="93%" border="0" cellspacing="0" cellpadding="0" class="p9" valign="middle" align="center">
                    <tr>
              <td align="center">&nbsp;</td>
                    </tr>
    <tr> 
              <td> <div valign="middle" align="center"><font color="#ff0000"><b><%=request.getParameter("stname")%>,您好!您的个人求职信息已经进入我们的数据库!</b></font> </div></td>
            </tr>
            <tr> 
              <td>
       <table width="81%" border="0" cellspacing="3" cellpadding="2" valign="middle" align="center" class="p9">
                  <tr valign="middle" align="center" bgcolor="#F0F0F0"> 
                    <td><font color="#ff0000"><b>您的用户代码是:<%=request.getParameter("stid")%></b></font></td>
                    <td><font color="#ff0000"><b>您的密码是:<%=request.getParameter("stpassword")%></b></font></td>
                  </tr>
                </table>
     </td>
            </tr>
          
            <tr> 
              <td align="center"> <hr noshade size="2">
                请记好您的用户代码和密码,以后需要它来 更新/修改/删除 您的个人信息和查询招聘信息. <br>
                您现在就可以在;<a href="file:///F|/index.jsp"><font color="#ff0000">求职查询</font></a>&quot;中输入相关条件查出您的求职资料,若有错误请及时修改。<br> 
                <br>
              </td>
            </tr>
            <tr>
              <td align="center">&nbsp;</td>
            </tr>
          </table>
        </td>
      </tr>
      <tr> 
        <td>&nbsp;</td>
      </tr>
    </table>
    <!--插入底部信息-->
    <div align="center"> 
     <table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="1" bgcolor="adadad"></td>
        <td height="115" background="file:///F|/zp_imags/d_04.gif">
    <table width="776" border="0" align="center" cellpadding="0" cellspacing="3">
          <tr>
            <td height="8"></td>
          </tr>
          <tr>
            <td align="center" valign="middle"><div align="center">
                   <a href="file:///F|/qz_gywm.jsp" class="left4">关于我们</a> | <a href="file:///F|/qz_yqlj.jsp" class="left4">友情链接</a> 
                  | <a href="file:///F|/qz_member.jsp" class="left4">加入会员</a> | <a href="file:///F|/qz_liuyan.jsp" class="left4" >留言板</a> 
                  | <a href="file:///F|/qz_links.jsp" class="left4">著名用户</a> | <a href="file:///F|/csearch.jsp?no=54440" class="left4">本站招聘</a> 
                  | <a href="file:///F|/qz_czdl.jsp" class="left4">诚征代理</a> </div></td>
          </tr>
          <tr>
            <td><div align="center">业务热线:0571-2891644* (中继线共12条) 传真:暂无 <br>
                地址:浙江工业大学屏风校区家和东苑2# <br>
                Copyright &copy;大学生求职信息网 1999-2006, All Rights Reserved <br>
                </div></td>
          </tr>
        </table></td>
        <td width="1" bgcolor="adadad"></td>
      </tr>
    </table></div>
    </body>
    </html>以上是全部的代码,但是没有涉及"finally"的呀!!
    不明白啊
      

  2.   

    }finally{
       rs.close();
       sql.close();
       con.close();
       }
    楼主你的ResultSet rs = null;
    后面又rs.close();本来就是NULL,不用关的,把这一行去掉,试试
      

  3.   

    另外,楼主在finally块里最好这样写
    finally{
    if(rs!=null){
    rs.close();
    }
    if(sql!=null){
    sql.close();
    }
    if(con!=null){
    con.close();
    }
    }
    这样写一般不会报错;
      

  4.   

    非常感谢"风"朋友!
    不好意思,
    }finally{  
         rs.close();  
         sql.close();  
         con.close();  
         }  这里是我后来加的,完整的代码是最上面描述中的是全部了,我再贴一次.<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>大学生求职信息网</title></title><link href="file:///F|/compzhuye.files/css.css" type=text/css rel=stylesheet>
    </head><body>
    <%
       String id=request.getParameter("stid");
       String psw=request.getParameter("stpassword");
       String name=request.getParameter("stname");
       String card=request.getParameter("stshenfenhaoma");
       String sex=request.getParameter("stsex");
       String address=request.getParameter("stjiguan");
       String brithday=request.getParameter("stage");
       String profession=request.getParameter("stsp");
       String school=request.getParameter("stschool");
       String xueli=request.getParameter("stxueli");
       String tel=request.getParameter("sttel");
       String e_mail=request.getParameter("stemail");
       String english=request.getParameter("stenglish");
       String compter=request.getParameter("stcompt");
       String height=request.getParameter("sttall");
       String qiuzhi=request.getParameter("stqiuzhi");
       String introduce=request.getParameter("stjieshao");
       
       
       Connection con = null;
       Statement sql = null;
       ResultSet rs = null;
       try {
           Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       }
       catch(ClassNotFoundException event){}
       try{
       con=DriverManager.getConnection("jdbc:odbc:moon","sa","");
       sql=con.createStatement();
       String infor = ("INSERT INTO stinfor(stid,stpassword,stname,stcardnumber,stsex,staddress,stage,stprofession,stschool,stxueli,sttel,stemail,stenglish,stcompt,sttall,stqiuzhi,stjieshao) VALUES('"+
                    id+"','"+psw+"','"+name+"','"+card+"','"+
                    sex+"','"+address+"','"+brithday+"','"+profession+"','"+
                    school+"','"+xueli+"','"+tel+"','"+e-mail+"','"+english+"','"+compter+"','"+height+"','"+qiuzhi+"','"+intriduce+"')");
       sql.executeUpdate(infor);
       }
    %>
    <div align="center"><table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="1" bgcolor="#ADADAD"></td>
        <td>
    </table>     
         
    <table width="776" border="0" cellspacing="0" cellpadding="0">
            <tr> 
              <td width="199" rowspan="2"><img src="file:///F|/qz_imags/logo.gif" width="200" height="65" border="0" usemap="#Map"></td>
              <td width="577" height="38" align="center" valign="middle" background="file:///F|/qz_imags/d_01.gif">
        <table width="80%" border="0" cellpadding="0" cellspacing="3">
                  <tr> 
                    <td width="194" height="18" valign="middle"> <div align="left"><font color="#FF0000"><%=request.getParameter("stname")%></font> 
                        您好!欢迎光临</div></td>
                    <td width="185"><%=getDate%></td>
                   
                  </tr>
                </table>
           
            <tr> 
              <td height="27" align="center" valign="bottom" background="file:///F|/qz_imags/d_02.gif">
        <table width="75%" border="0" cellspacing="0" cellpadding="0">
                  <tr align="center"> 
                    <td><a href="file:///F|/stzhuce.jsp" ><img src="file:///F|/qz_imags/en_01.gif" width="81" height="15" border="0"></a></td>
                    <td><img src="file:///F|/qz_imags/en_00.gif" width="5" height="16"></td>
                   
                  </tr>
                </table>
    </table>
    <map name="Map2">
      <area shape="rect" coords="25,2,167,41" href="http://大学生求职信息网">
      <area shape="rect" coords="35,46,163,62" href="file:///F|/index.jsp">
    </map>
    <map name="Map">
      <area shape="rect" coords="24,2,169,41" href="http://大学生求职信息网">
      <area shape="rect" coords="36,46,159,58" href="file:///F|/index.jsp">
    </map>
    </body>
    </html>
    </div>  
    <table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr> 
        <td width="1" rowspan="3" bgcolor="adadad"></td>
        <td width="776" align="center"><br><img src="file:///F|/qz_imags/grjlzc.gif" width="154" height="27"><br><br></td>
        <td width="1" rowspan="3" bgcolor="adadad"></td>
      </tr>
      <tr> 
        <td align="center"> 
          <table width="93%" border="0" cellspacing="0" cellpadding="0" class="p9" valign="middle" align="center">
                    <tr>
              <td align="center">&nbsp;</td>
                    </tr>
    <tr> 
              <td> <div valign="middle" align="center"><font color="#ff0000"><b><%=request.getParameter("stname")%>,您好!您的个人求职信息已经进入我们的数据库!</b></font> </div></td>
            </tr>
            <tr> 
              <td>
       <table width="81%" border="0" cellspacing="3" cellpadding="2" valign="middle" align="center" class="p9">
                  <tr valign="middle" align="center" bgcolor="#F0F0F0"> 
                    <td><font color="#ff0000"><b>您的用户代码是:<%=request.getParameter("stid")%></b></font></td>
                    <td><font color="#ff0000"><b>您的密码是:<%=request.getParameter("stpassword")%></b></font></td>
                  </tr>
                </table>
     </td>
            </tr>
          
            <tr> 
              <td align="center"> <hr noshade size="2">
                请记好您的用户代码和密码,以后需要它来 更新/修改/删除 您的个人信息和查询招聘信息. <br>
                您现在就可以在;<a href="file:///F|/index.jsp"><font color="#ff0000">求职查询</font></a>&quot;中输入相关条件查出您的求职资料,若有错误请及时修改。<br> 
                <br>
              </td>
            </tr>
            <tr>
              <td align="center">&nbsp;</td>
            </tr>
          </table>
        </td>
      </tr>
      <tr> 
        <td>&nbsp;</td>
      </tr>
    </table>
    <!--插入底部信息-->
    <div align="center"> 
     <table width="778" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="1" bgcolor="adadad"></td>
        <td height="115" background="file:///F|/zp_imags/d_04.gif">
    <table width="776" border="0" align="center" cellpadding="0" cellspacing="3">
          <tr>
            <td height="8"></td>
          </tr>
          <tr>
            <td align="center" valign="middle"><div align="center">
                   <a href="file:///F|/qz_gywm.jsp" class="left4">关于我们</a> | <a href="file:///F|/qz_yqlj.jsp" class="left4">友情链接</a> 
                  | <a href="file:///F|/qz_member.jsp" class="left4">加入会员</a> | <a href="file:///F|/qz_liuyan.jsp" class="left4" >留言板</a> 
                  | <a href="file:///F|/qz_links.jsp" class="left4">著名用户</a> | <a href="file:///F|/csearch.jsp?no=54440" class="left4">本站招聘</a> 
                  | <a href="file:///F|/qz_czdl.jsp" class="left4">诚征代理</a> </div></td>
          </tr>
          <tr>
            <td><div align="center">业务热线:0571-2891644* (中继线共12条) 传真:暂无 <br>
                地址:浙江工业大学屏风校区家和东苑2# <br>
                Copyright &copy;大学生求职信息网 1999-2006, All Rights Reserved <br>
                </div></td>
          </tr>
        </table></td>
        <td width="1" bgcolor="adadad"></td>
      </tr>
    </table></div>
    </body>
    </html>
      

  5.   

    在你的catch(ClassNotFoundException event){
    event.printStackTrace();
    }
    另外你下面的一个try{
    ...
    }对应的catch呢???
      

  6.   

    非常感谢风的帮助 ,继续查找了下问题,发现确实是少了一个catch.
    其中有一些语法错误,谢谢