在servlet中写javaScript的alert语句不好使!!!急急急!!!!在线等待....
提问 :从HTML页面跳到servlet,处理完毕之后想用
out.print( " <script> alert(\ "对不起!因为您超出一个月没有登录,您的帐户已经被冻结,请您点击确认激活..\ "); </script> ");
输出脚本对话框,但是没有反应...而是直接跳到了后续的处理业务中....
package empmanager.servlet;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import empmanager.comm.DB;
public class LoginServlet extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK ";
//Initialize global variables
public void init() throws ServletException {
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
DB db = new DB();
HttpSession session = request.getSession();
String name = request.getParameter( "loginname ");
String password = request.getParameter( "password ");
int info = db.proc_login(name, password); // 得到用户距上次登录的时间差(月数)
if (info == 1) {
session.setAttribute( "loginor ", name);
response.sendRedirect( "empservlet ");
} else if (info == 2) {
out.print( " <script> alert(\ "对不起!因为您超出一个月没有登录,您的帐户已经被冻结,请您点击确认激活..\ "); </script> ");
session.setAttribute( "loginor ", name);
response.sendRedirect( "activationservlet "); // 跳转到激活servlet
} else if (info == 3) {
&n