2017-11-09 13:46

@JFinal 波总,调用还需要改什么配置的东西嘛?

2017-11-09 09:21

@JFinal 波总,这些demo找到了,但是比如我想运行一下:

public void createUser() {
String json = "{\"userid\": \"Javen205\"," + "\"name\": \"Javen205\"," + "\"department\": [3],"
+ "\"position\": \"产品经理\"," + "\"mobile\": \"\"," + "\"gender\": \"1\"," + "\"email\": \"\","
+ "\"weixinid\": \"Javen205\","
// +"\"avatar_mediaid\":
// \"2-G6nrLmr5EC3MNb_-zL1dDdzkd0p7cNliYu9V5w7o8K0\","
+ "\"extattr\": {\"attrs\":[{\"name\":\"爱好\",\"value\":\"旅游\"},{\"name\":\"卡号\",\"value\":\"1234567234\"}]}}";
System.out.println(json);
ApiResult apiResult = ConUserApi.createUser(json);
renderText(apiResult.getJson());
}

应该放到哪里运行呢?

2017-07-24 15:00

@杜福忠 比如咱们向百度传一个值,应该怎么做到呢?

2017-07-24 14:59

@杜福忠 这个POST怎么向URL传值呢?

2017-07-24 14:09

@JFinal 波总,我需要填什么post的键才能让百度返回给我搜索的值呢?
public static void main(String[] args) {
String url = "http://www.baidu.com";
Map queryParas = new HashMap();
queryParas.put("appKey", "41B294F431CAF945ED204E6171759D15DA92A73E");
String ret = HttpKit.post(url, JSON.toJSONString(queryParas));
System.out.println(ret);
}
这个写的返回总是页面不存在。
波总帮帮忙啊

2017-07-24 11:09

@JFinal 波总,我用POST,

public static void main(String[] args) {
String url = "http://www.baidu.com";
Map queryParas = new HashMap();
queryParas.put("appKey", "41B294F431CAF945ED204E6171759D15DA92A73E");
String ret = HttpKit.post(url, JSON.toJSONString(queryParas));
System.out.println(ret);
}

给我返回的页面是页面不存在,应该怎么处理呢

2017-07-24 10:32

@JFinal 好,我去看一下手册

2017-07-24 10:30

@JFinal 好的,谢谢你,波总,非常感谢!!!!

2017-07-24 10:28

@JFinal POST的Date需要填什么呢?

2017-07-24 10:25

@JFinal 可以了,谢谢。出来了,这个是不是接收返回值?接受页面的东西,这框架真的贼好用!!!

2017-07-24 10:22

这是报错内容:
Exception in thread "main" java.lang.RuntimeException: java.net.MalformedURLException: no protocol: www.baidu.com
at test_kit.HttpKit.get(HttpKit.java:124)
at test_kit.HttpKit.get(HttpKit.java:134)
at test_kit.HttpKit.main(HttpKit.java:264)
Caused by: java.net.MalformedURLException: no protocol: www.baidu.com
at java.net.URL.(Unknown Source)
at java.net.URL.(Unknown Source)
at java.net.URL.(Unknown Source)
at test_kit.HttpKit.getHttpConnection(HttpKit.java:89)
at test_kit.HttpKit.get(HttpKit.java:119)
... 2 more

2017-07-24 10:20

@JFinal
public static void main(String[] args) {
String url = "www.baidu.com";
Map queryParas = new HashMap();
System.out.println(HttpKit.get(url, queryParas));
}
这样报错