Mr_Huang_ning
2017-08-25 12:20springmvc和mybatis多对一的查询在controller返回数据时报空指针?
@RequestMapping(method=RequestMethod.GET)
@ResponseBody
public TaoResult queryListByPage(@RequestParam(value="page",defaultValue="1") Integer page,@RequestParam(value="rows") Integer pageSize){
TaoResult list=itemService.queryListByPage(page,pageSize);
return list;
}
我是这么写的,list中是有数据的,为什么回显报空指针
HTTP Status 500 - Could not write content: (was java.lang.NullPointerException) (through reference chain: com.taotao.common.result.TaoResult["rows"]->java.util.ArrayList[0]->com.taotao.manager.pojo.Item["itemCat"]->com.taotao.manager.pojo.ItemCat["state"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: com.taotao.common.result.TaoResult["rows"]->java.util.ArrayList[0]->com.taotao.manager.pojo.Item["itemCat"]->com.taotao.manager.pojo.ItemCat["state"])这是报的错,就是数据转json对象报空指针了,因为我的前端是用的Easyui,所以需要json对象数据
- 点赞
- 回答
- 收藏
- 复制链接分享
5条回答
为你推荐
- 求前辈推荐springmvc和mybatis的书,多谢!
- mybatis
- spring
- 推荐
- 书
- 书籍
- 2个回答
- springmvc mybatis 原理
- mybatis
- spring
- 3个回答
- mybatis 多表查询 resultMap结果集怎么传到Controller
- mybatis
- java
- 12个回答
- springmvc在controller层如何接收参数绑定到实体类?
- spring
- 4个回答
- springmvc的controller接收json数据失败
- json
- spring
- 7个回答