代码:
response.getWriter().print("<body onLoad=\"checkForm()\"><script language=\"JavaScript\" type=\"text/JavaScript\">function checkForm(){ \n" +
" alert(\"You have no access to this attachment!\");return true;}</script></body>");
如果上面那段代码同时和response的重定向一起使用,就冲突了,必须舍其一,eg:
response.sendRedirect(request.getContextPath() +
"/faces/navigation.jspx");