您的位置:首页 > 编程语言 > Java开发

SpringMvc 方法头忘记标记@ResponseBody导致404

2016-09-06 11:40 344 查看
@RequestMapping(value = "/time/now",method = RequestMethod.GET)
public SeckillResult<Long>  time(){
Date now= new Date();
return  new SeckillResult<Long>(true,now.getTime());
}


方法没加@ResponseBody

报错 HTTP Status 404 - /WEB-INF/jsp/seckill/time/now.jsp


应改为:

@RequestMapping(value = "/time/now",method = RequestMethod.GET)
@ResponseBody
public SeckillResult<Long>  time(){
Date now= new Date();
return  new SeckillResult<Long>(true,now.getTime());
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  spring mvc
相关文章推荐