jsp里面,使用response.sendRedirect()进行页面跳转的同时使用response.getWriter()进行提示信息,这样会直接跳转。提示信息就没有了。解决办法:
response.getWriter().print("<script languge='javascript'>alert('用户名密码不匹配!'); window.location='../index.html'</script>");
这样会出现中文乱码,解决中文乱码后就能够跳转和提示了。
处理乱码:
rsp.setHeader("Content-type", "text/html;charset=UTF-8");
rsp.setCharacterEncoding("UTF-8");
注意:跳转的页面一定要写正确。