@JFinal 你好,想跟你请教个问题:
我使用JFinal2.0,接收HttpComponents模拟POST传值。
我使用原声的servlet可以接收参数和值。
使用JFinal只能接收到参数,没有值是什么问题?
模拟代码:
HttpPost post = new HttpPost("http://localhost:8080/JFinalWeb/hello"); //HttpPost post = new HttpPost("http://localhost:8080/TestServlet/hello"); HttpClient client = HttpClients.createDefault(); try { StringEntity reqEntity = new StringEntity("id=123&protocol='tyeodng'"); // 设置类型 reqEntity.setContentType("application/x-www-form-urlencoded"); post.setEntity(reqEntity); HttpResponse response =client.execute(post); System.out.println(response.getStatusLine()); HttpEntity resEntity = response.getEntity(); if (resEntity != null) { System.out.println("--------------------------------------"); System.out.println("Response content: " + EntityUtils.toString(resEntity, "UTF-8")); System.out.println("--------------------------------------"); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }