缓冲的读取器返回Null

Hi i send an ajax call to server like this

$.ajax({
    type: 'POST',
    url: "...",
    dataType:'json',
    data:JSON.stringify(contact),
    success:function(){
        alert("success")
    }

At server i handle this request and trying to read the json object from request like this.

StringBuilder sb = new StringBuilder();
try {
        BufferedReader br = new BufferedReader(new 
InputStreamReader(request.getInputStream()));
        String line = null;
        while ((line = br.readLine()) != null) {
            sb.append(line);
        }
    } catch (IOException e) {
    }

but br.readLine() returns null. Any idea why it happens?

查看全部
weixin_33729196
weixin_33729196
2011/08/10 07:59
  • java
  • json
  • bufferedreader
  • ajax
  • 点赞
  • 收藏
  • 回答
    私信

2个回复