您的位置:首页 > 其它

编写servlet的相关问题

2016-04-23 09:00 363 查看
(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与火狐的兼容性问题,有的方法并不能运行出来,总之两个都试试吧
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: