jsp <%%>程序段里的catch语句里怎么弹出提示框?
<%request.setCharacterEncoding("utf-8");//防止乱码
String id = request.getParameter("id");
int a=0;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:student");
Statement stat = conn.createStatement();
String sql = "delete from chengji where id = '" +id+ "'";
int i = stat.executeUpdate(sql);
a=a/i;
out.print("成功删除" + i + "行记录!");
stat.close();
conn.close();
}
catch(Exception e){ out.print("<%=check()%>"); }
%>
代码里的 catch语句体里该怎么写?
我在开头定义的下面的
<script language="javascript" type="text/javascript">
function check(){ alert("删除记录失败!请检查学号是否存在!");}
</script>
求老师们指教下
快期末考试了、、蛋疼啊、、