There was an unexpected error (type=Internal Server Error, status=500). getWriter() has already been

逃离我推掉我的手 2023-05-31 10:24 165阅读 0赞

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Oct 24 16:28:23 CST 2019
There was an unexpected error (type=Internal Server Error, status=500).
getWriter() has already been called for this response

//这么写会报以上的错误
//注意:response.getWriter()后无法进行@ResponseBody的响应操作

  1. @RequestMapping("/result")
  2. @ResponseBody
  3. public String result(HttpServletRequest request,HttpServletResponse response){
  4. String returnDesc = "操作成功";
  5. response.getWriter().print(returnDesc);
  6. return returnDesc;
  7. }

发表评论

表情:
评论列表 (有 0 条评论,165人围观)

还没有评论,来说两句吧...

相关阅读