如题,在servlet写一句话:PrintWriter out=response.getWriter();
out.println("<script language=\"javascript\">" +"alert(\'登陆成功!\')"+"</script>");
response.sendRedirect("chat/communicate.jsp");
但是在提交后,直接跳转到chat/communicate.jsp页面了,没有alert,有人说不用sendRedirect(),直接在script脚本中写
window.location.href="chat/communicate.jsp"但是还是不行,有没有人有好办法啊,求救...
out.println("<script language=\"javascript\">" +"alert(\'登陆成功!\')"+"</script>");
response.sendRedirect("chat/communicate.jsp");
但是在提交后,直接跳转到chat/communicate.jsp页面了,没有alert,有人说不用sendRedirect(),直接在script脚本中写
window.location.href="chat/communicate.jsp"但是还是不行,有没有人有好办法啊,求救...
解决方案 »
- 如何用tomcat设置多个端口
- JSP弹出提示框
- 高分求解,spring+hibbernate不执行更新能查询
- Hibernater的session.flush()方法的疑问
- <html:link> 的href属性 为何无法传递JSESSIONID
- 如何面对书中的例子程序哪?
- 请问用jbuilder做的一个应用程序怎样生成exe文件?或者叫打包?
- 有米有人能给我说说状态会话BEAN的主要应用范围?
- jbj7开发cmpEJB2.0,怎么添加findAll!??
- 移动端 java后台把 caf、amr格式的音频文件转换成MP3格式文件
- 求救大神们,servlet页面中如何使得提交的页面alert
- MySql文字编码的问题
out.print("<script>alert('登录成功');</script>");登录
out.print(...)?
对
<%out.print("<script>alert('登录成功');</script>");
%>
response.sendRedirect("chat/communicate.jsp");
上面那一句不要
直接把那段js写在communicate.jsp中试一试
out.println("<script>window.location.href='index2.jsp';alert('aaa');</script>");
当然你还可以转到一个window.open的页面!
第一种: 在chat/communicate.jsp里面<body onload="alert('xxxxx');">
第二种:修改
PrintWriter out=response.getWriter();
out.println("<script language=\"javascript\">" +"alert(\'登陆成功!\')"+"</script>");
response.sendRedirect("chat/communicate.jsp");为
PrintWriter out=response.getWriter();
out.println("<script language=\"javascript\">" +"alert(\'登陆成功!\')"+";window.location.href='chat/communicate.jsp'</script>");
out.close();