js代码如下
function post(msg){
var request = simpleXhrFactory.createXhrObject();
request.open("post","index.do",false);
request.setRequestHeader("Content-Type","text/plain");
request.send(msg);
}
post("hehe");
后台的代码该如何写:
public void doPost(HttpServletRequest request , HttpServletResponse response) throws IOException, ServletException{
System.out.println("ContentType is "+request.getContentType());
//如何打印出请求的正文呢
}