public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
Map countryList = new HashMap();
String str = "http://10.10.10.25/TEPortalIntegration/CustomerPortalAppIntegrationService.svc/PaymentSchedule/PEPL/Unit336";
try {
URL url = new URL(str);
URLConnection urlc = url.openConnection();
BufferedReader bfr = new BufferedReader(new InputStreamReader(urlc.getInputStream()));
String line, title, des;
while ((line = bfr.readLine()) != null) {
JSONArray jsa = new JSONArray(line);
for (int i = 0; i < jsa.length(); i++) {
JSONObject jo = (JSONObject) jsa.get(i);
title = jo.getString("Amount");
countryList.put(i, title);
}
renderRequest.setAttribute("out-string", countryList);
super.doView(renderRequest, renderResponse);
}
} catch (Exception e) {
}
}
liferay 포틀릿 클래스의 json
개체에 액세스하려고하고 있는데 어떤 json
필드의 값 배열을 JSP 페이지에 전달하려고합니다.Java 클라이언트에서 JSON Webservice를 사용하는 방법은 무엇입니까?
JSONArray로 변환하기 전에 전체 응답을 읽어야합니다. 응답의 각 개별 행은 (유효하지 않은) JSON 조각이 될 것이므로 분리하여 구문 분석 할 수 없습니다. – Perception