重定向 jsp

当点击弹出的对话框中的确定按钮后转向另一个页面。

out.println("<script>window.alert('您的数据转换成功!');location.href('downLoad.jsp')</script>");

若在C#中则为:

Response.Write("<script>window.alert('消息');location.href('Tree.aspx')</script>");

当点击界面中的确定按钮后:对确定的判断

<%
    if(request.getParameter("submit")!=null)
     { 
       //确保字符串中如果有中文也不会出现乱码,此方法只能对第个字段来转换,但不能对整个文件的内容来转换,eg。上传上件
       String serviceType = new String( request.getParameter("information").getBytes("iso8859-1"), "gb2312");
       request.setCharacterEncoding("gb2312");
       
       c.transit(serviceType);
     out.println("<table ALIGN=\"center\"><tr><td bgcolor=\"#EAEAEA\">匹配度:</td><td bgcolor=\"#F0FFF0\">"+c.qom+"</td></tr></table>");
 
  if(c.qom<0.75){
  out.println("<script language=\"javascript\"> alert(\"你的数据匹配度低,无法转换,请保证内容遵从行业标准\"); </script>");
  }
  else{
  //out.println("<script language=\"javascript\"> alert(\"您的数据转换成功!\"); </script>");
  out.println("<script>window.alert('您的数据转换成功!');location.href('downLoad.jsp')</script>");//当点击弹出的对话框中的确定按钮后转向另一个页面。
  }
  //response.sendRedirect("downLoad.jsp");
 } 
    %>

posted @ 2010-03-31 14:18  suzihuy  阅读(243)  评论(0编辑  收藏  举报