Action中弹出js

Action中弹出js
HttpServletResponse hrs = (HttpServletResponse)response;
    hrs.setContentType("text/html; charset=utf-8");
    ServletOutputStream os = hrs.getOutputStream();
    String contextPath = ((HttpServletRequest)request).getContextPath();
    os.print("<script>alert('test);window.location.href='"+contextPath+"/mypage/user_info.jsp';</script>");
    /*ActionForward forward=new ActionForward("/mypage/user_info.jsp");
    forward.setRedirect(true);*/
    return null;

你可能感兴趣的:(Action中弹出js)