码迷,mamicode.com
首页 > 编程语言 > 详细

springmvc:Failed to convert value of type

时间:2015-06-11 08:13:33      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:

环境: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


springmvc:Failed to convert value of type

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!