发布网友 发布时间:2024-10-23 18:00
共1个回答
热心网友 时间:2024-11-06 05:28
public String addBj() throws Exception
{
bjManager.save(bj);
response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");//防止弹出的信息出现乱码
//以上2句代码一定要写在获取out对象之前,否则提示信息为乱码
PrintWriter ut = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.println("<script. language='JavaScript'>alert(\"添加成功!\");
location.replace('xs/test/findAllBj.action');</script>");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
return null;
}