我正在使用org.codehaus.jackson.map.ObjectMapper来返回一个Jason对象。我将列表保留在请求中但无法从jsp访问它。还有其他办法吗?
response.setContentType("application/json");
response.setHeader("cache-control", "no-cache");
ObjectMapper mapper = new ObjectMapper();
try {
ArrayList list = cservice.getPolicyList(lastName);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(amount > 0){
request.setAttribute("dataList", list);
result = "{\"success\": true,\"amount\"}";
}else{
result = "{\"success\": false,\"message\": \"We could not find any records. Please verify your search criteria.\"}";
}
//Finally send the jason response
OutputStream out = response.getOutputStream();
mapper.writeValue(out, result);