Error when running: Request method ‘GET‘ not supported

When Xiao Tang was writing a project, he was not careful enough, which caused the project to run out of time.

org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported

As shown in the figure:
Insert image description here
Because GET and POST are errors caused by data interaction, Xiao Tang directly locked the control layer and front-end page, and finally determined that there was a problem with the form data rendering interaction method. , it turns out that our form defaults to the GET method for data interaction, and when I wrote the back-end control layer, I used @PostMapping("/search"), which conflicted with the front-end, causing the data to not be rendered and interacted normally< a i=2> As shown in the figure: Then there are two modification methods: (1) Modify the backend: change @PostMapping(“/search”) For @GetMapping(“/search”) (2) Modify the front end: Change the default GET method of the form form to the POST method, just add method="post" to the form
Insert image description here


When it comes to analyzing specific problems, Xiao Tang can’t say for sure, but this is the problem I encountered, and it was solved in such a simple way!

Guess you like

Origin blog.csdn.net/qq_49014164/article/details/129192961