更改从返回结果
Map给
List<CscGodownBean>放:
retrun godown_list如此;
@RequestMapping("/getGodowns")public @ResponseBody List<CscGodownBean>getGodownsbasedonDistrict(@RequestParam(value="district_pre") String dist_pre) {List<CscGodownBean> godown_list = new ArrayList<CscGodownBean>();String exception = null;try{ //getting name and pres here godown_list = scm_service.getGodownListBesedonDistCode(dist_pre);}catch(Exception ex){ ex.printStackTrace(); exception = ex.getMessage();}return godown_list ;}更新
您可以将结果作为字符串返回,您将获得所需的内容:
@RequestMapping("/getGodowns")public @ResponseBody StringgetGodownsbasedonDistrict(@RequestParam(value="district_pre") String dist_pre) {List<CscGodownBean> godown_list = new ArrayList<CscGodownBean>();String exception = null;try{ //getting name and pres here godown_list = scm_service.getGodownListBesedonDistCode(dist_pre);}catch(Exception ex){ ex.printStackTrace(); exception = ex.getMessage();}ObjectMapper objectMapper = new ObjectMapper(); objectMapper.enable(SerializationFeature.INDENT_OUTPUT); String arrayToJson = objectMapper.writevalueAsString(godown_list); System.out.println("Convert List to JSON :"); System.out.println(arrayToJson);return arrayToJson ;}返回的字符串是json格式。



