编写servlet的相关问题

来源:互联网 发布:vb手机版下载 编辑:程序博客网 时间:2024/06/05 16:34
(1)response.setContentType("text/html;charset=utf-8");PrintWriter writer=response.getWriter();writer.println("<script>alert('用户名或密码不正确!');window.location.href='adminlogin.jsp';</script>");
(2)
response.setContentType("text/html;charset=utf-8");PrintWriter out = response.getWriter();out.write("<script language='javascript'>alert('操作失败!');" +"window.location.href='"+request.getContextPath()+"/admin/addprice.jsp?id="+id+"';</script>");
这两个都可以在浏览器上成功运行出来,但是由于由于IE与火狐的兼容性问题,有的方法并不能运行出来,总之两个都试试吧
0 0
原创粉丝点击