哈哈,你一定是在执行数据库操作之前执行了javascript

解决方案 »

  1.   

    没有呀是下边这段
    try{
       Rst=Stmt.executeQuery("select faculty_sub_num from teach_faculty where faculty_id="+sub_f_id);
       Rst.next();
       int faculty_sub_num=Rst.getInt("faculty_sub_num")-1;
       Stmt.executeUpdate("Update teach_faculty set faculty_sub_num="+faculty_sub_num+" where faculty_id="+sub_f_id);
    Stmt.executeUpdate("delete from teach_subject where sub_id="+sub_id);
        Rst=Stmt.executeQuery("select unit_id from teach_unit where unit_s_id="+sub_id);
    while(Rst.next())
    {
     int unit_id=Rst.getInt("unit_id"); 
     id[i]=unit_id;
     i+=1;
    }
    Stmt.executeUpdate("delete from teach_unit where unit_s_id="+sub_id);
    for(j=0;j<i;j++)
    {
             Stmt.executeUpdate("delete from teach_part where part_u_id="+id[j]);//
          }%>
    <script language="JavaScript">//如果是离开就回到首页
    //top.location.href="op_faculty.jsp?out=true"   
    </script>这个页面是一个框架中的,最后的javascript是让这个框架转到别的页面可是如果加上转跳它就不读数据库了,要是不加转跳,就没有问题.......为什么呀?
      

  2.   

    if (your program) {}
    else {}
      

  3.   

    Jsp是在服务器端执行的
    javascript是在浏览器端执行的