1. 程式人生 > >json字符串傳到前臺input

json字符串傳到前臺input

info arr set from super 字符串 tostring inpu req

JSONObject把對象轉換成的json字符串,無法直接通過request.setAttribute();傳到頁面的input標簽

如下是錯誤的:
request.setAttribute(“pageInfoJsonStr”, JSONObject.fromObject(pageInfo).toString());

還需要 jsonStr.replaceAll(“\”“, “’”)再放到request.setAttribute中
---------------------

JSONArray jsonList = new JSONArray();

if (TaskListReturn != null) {
jsonList = JSONArray.fromObject(TaskListReturn);
}
if (SuperviseManage != null) {
SuperviseManage.put("list", TaskList);
String obj = jsonList.toString();
obj = obj.replace("\"", "‘");
SuperviseManage.put("jsonList", obj);
}
SuperviseManage.put("TaskcountReturn", TaskcountReturn);

json字符串傳到前臺input