springmvc:Failed to convert value of type

时间:2015-06-11 08:10:56   收藏:0   阅读:611

环境:springmvc + ajax

前端代码:

<script type="text/javascript">
				var menu = {id:1,name:"首页"};
				$.getJSON("/site/menu/queryMenuPage", {
					menu :$.toJSON(menu),
					pageNum : 1,
					pageSize : 5
				}, function(data) {
					alert(data);
				});
			</script>

控制器代码:

@SuppressWarnings({ "unchecked", "rawtypes" })
	@RequestMapping(value="/queryMenuPage")
	public @ResponseBody Page<Menu> queryMenuPage(@RequestParam Menu menu,Integer pageNum,Integer pageSize){
		com.github.pagehelper.Page<Menu> _page = PageHelper.startPage(pageNum, pageSize, true);
		List<Menu> menuList = menuService.queryMenuList(null);
		try {
			System.err.println("pageSize:"+JsonUtil.bean2JsonStr(pageSize));
			System.err.println("pageNum:"+JsonUtil.bean2JsonStr(pageNum));
			System.err.println("menu:"+JsonUtil.bean2JsonStr(menu));
			System.err.println("_page:"+JsonUtil.bean2JsonStr(_page));
			System.err.println("menuList:"+JsonUtil.bean2JsonStr(menuList));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return new Page(_page,menuList);
	}

报错:

message Failed to convert value of type ‘java.lang.String‘ to required type ‘com.join.stump.site.domain.Menu‘; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.join.stump.site.domain.Menu]: no matching editors or conversion strategy found


原文:http://my.oschina.net/psuyun/blog/465367

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!