我想创建一个获取json响应的http get请求.在该会话响应中,我想将值存储到我的会话中.这怎么可以实现? 谢谢 这是示例代码.你会在recvbuff中得到回应. %@page import="java.io.*" %%@page import="ja
谢谢
这是示例代码.你会在recvbuff中得到回应.<%@page import="java.io.*" %> <%@page import="java.net.*" %> <% String recv; String recvbuff; URL jsonpage = new URL("http://www.yoursite.com/jsonresponse"); URLConnection urlcon = jsonpage.openConnection(); BufferedReader buffread = new BufferedReader(new InputStreamReader(urlcon.getInputStream())); while ((recv = buffread.readLine()) != null) recvbuff += recv; buffread.close(); System.out.println(recvbuff); %>