我正在尝试借助jackson-mapper-asl
库将对象列表转换为 json,但作为响应,我收到了 http406
错误。jackson-mapper-asl
图书馆在我的班级路径上。以下是我的 Spring MVC 控制器代码:
@RequestMapping(value="/find-sub-categories/{parentId}", method=RequestMethod.GET)
@ResponseBody public List<ProductCategory> findSubCategories(@PathVariable(value="parentId") ProductCategory productCategory) {
logger.info("In ADMIN findSubCategories Contoller AJAX GET");
List<ProductCategory> categories = productCategoryService.findAllChildProductCategoriesByParent(productCategory);
return categories;
}
我的 Ajax 请求代码:
$.ajax({
url: url+"/"+parentId,
type: 'GET',
success: function(result) {
var arr = $.parseJSON(result);
-----------------------