Java后端实现弹框
如下
response.setContentType("text/html;charset=utf-8");
PrintWriter writer = null;
try {
writer = response.getWriter();
writer.println("<script>alert(\"弹框!!\")</script>");
} catch (IOException e) {
e.printStackTrace();
}finally {
writer.close();
}
方法类中只能是void
否则会抛出异常