SpringMVC——記錄那些走過的坑(3)

springMVC出現HTTP Status 405 - Request method ‘GET’ not supported錯誤的解決方法

1.加入 @ResponseBody 註解或者加入isErrorPage=“true”。

 @RequestMapping(value="/order/{id}",method=RequestMethod.DELETE)
@ResponseBody

<%@ page contentType="text/html;charset=UTF-8" language="java"
         isErrorPage="true"%>

個人認爲這種治標不治本,因爲返回的只是一個字符串或者是json,而不能正確的讓編譯器知道

2.請求先轉給一個Controller,再返回jsp頁面。
3.tomcat換到7.0以及以下版本。(強烈推薦)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章