客户端:Part[] parts = { new StringPart("id", "aaa") };
post.setRequestEntity(new MultipartRequestEntity(parts, post
.getParams()));

client.executeMethod(post);
我想知道服务端怎么接收这个parts 是用request吗?如果是又是怎么做到的?

解决方案 »

  1.   

    客户端啊  我不是写着通过client.executeMethod()发出去了吗
      

  2.   

    楼主这不是服务器端的java代码?
      

  3.   

    客户端代码:
    HttpClient client = new HttpClient();
    PostMethod post = new PostMethod(
    "http://admin-pc:8080/8-8-PLAT/data/selectNode.json");
    post.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET,
    "utf-8");
    post.setRequestHeader("Content-Type", "application/json");
    Part[] parts = { new StringPart("id", "aaa") };
    post.setRequestEntity(new MultipartRequestEntity(parts, post
    .getParams()));
    // 发送请求
    client.executeMethod(post);
    // 获取服务端返回的json值
    String response = post.getResponseBodyAsString();
      

  4.   

    我在服务端一直用request.getParameter获取数据就是获取不到
      

  5.   

    你这个url被哪个action给拦截了 进去打上断点 这么简单的键值对 不应该出问题
      

  6.   

    我刚保证请求已经过去了 因为我在服务端断点能进入那个地址的方法上的 我用的是SpringMVC