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) {
}
}
我正在尝试json
从 liferay portlet 类访问对象,并且我想将任何字段的值数组传递json
给 jsp 页面。