public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
System.out.println("begin");
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
PrintWriter pw = response.getWriter();
StringBuffer buf = new StringBuffer();
for(int i = 0; i < 7; i++)
{
int status = (int)(Math.random() * 2);
buf.append("" + status );
}
System.out.println("message:\n" + buf.toString() + "\n");
pw.write(buf.toString());
pw.flush();
System.out.println("end");
}
web.xml配置: