调用gerWriter() 把script输出到页面
response.getWriter().out("<script>alert("hello world!");</script>") ;
页面就会弹出 hello world! 要学会分清楚应用程序的系统边界:在态蠢裂 JSP 中有一些代码是在服务器上执行的,而另一些代码则是在客户端执行的。
当然你也可以通过 跳转页帆闭面来实现,response.getSendRedirect(跳到那个档汪jsp页面的名称) ;
response.setContentType("text/html;charset=UTF-8");//中文需设置编码
response.getWriter().write("<script>alert('腔滑租你伍兆好!');</script>"让桥);