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

我想让script中句子执行完,后面的(删除句子)不执行了,怎么办?请高手帮忙
public   void   doGet(HttpServletRequest   request,   HttpServletResponse   response)
throws   ServletException,   IOException   {
response.setCharacterEncoding( "gb2312 ");
PrintWriter   out   =   response.getWriter();
out.print( " <html> <head> <script> if(!confirm( '确实要删除吗? '))window.history.go(-1); </script> </head> ");
out.print( "删除网页成功,2秒后将转入收藏主页面... ");
String   address=request.getParameter( "webaddress ");
String   name   =   "benwei ";
String   sql   =   "delete   from   collectioncontent   where   hrefaddress= ' "+address+ " '   and   username= ' "   +name+ " ' ";
TeacherDBBean   mm   =   new   TeacherDBBean();
//opdatabase_javabean   mm   =   new   opdatabase_javabean();
mm.executeUpdate(sql);
out.print( " <meta   http-equiv=refresh   content= '2;url=../ResourceStore/resource.jsp '> ");

------解决方案--------------------
你没有理解B/S程序怎么工作的,都是先全部执行完服务器代码才发送到客户端执行js代码的,所以,你必须根据对话框的是、否再进行一次提交。执行下面的删除