json字符串传到前台input
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);
====================
taskList = "${map.bean.jsonList}";
if(taskList!=null && taskList!=""){
entyList.url_list = eval('(' + taskList + ')');
taskList = eval('(' + taskList + ')');
}
var josnTaskList = JSON.stringify(entyList.url_list);
$("#taskList").val(josnTaskList);