Get the App
SLTechnology News&Howtos  ›  Development  › 

What to do when the SpringMVC project visits controller

Shulou Source: shulou.com Published: 2022-06-03 17:19:58 10月03日 Update

This article mainly introduces the SpringMVC project visit controller report 404 how to do, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor with you to understand.

SpringMVC reports 404 when visiting controller.

When I wrote the SpringMVC project, I suddenly found that the page displayed 404 when accessing the controller path, and the console did not report a serious error, only that the path could not be found and that it could be accessed normally by accessing jsp alone.

The console reported such an error.

No mapping found for HTTP request with URI [/ SpringWebScoket/user/login] in

All kinds of search methods on the Internet have not been solved.

First make a list of the various methods found.

1. Check the url path to see if it is written correctly. Sometimes it may be caused by the wrong path, such as the letter is written upside down, and cannot be found.

2. Whether MVC filtering is correct

SpringMVC /

Some friends say "/" and some friends say "/ *" in this configuration. I don't know which one is right. I can try them all.

3, static configuration, see some friends say, comment out the static configuration can be accessed, I do not know why.

There are others. I won't list them one by one here. I can't even try them all.

Finally solved.

Finally, I asked the god that there was a missing jar package for jackson-core, and cut out the configuration content in application.xml and paste it into the spring-mvc.xml configuration file. And then it was solved.

Possible reason why SpringMVC cannot access controller @ RequestMapping (value= "/ toplayindex", method= {RequestMethod.POST,RequestMethod.GET}) public ModelAndView toKpointPlay (HttpServletRequest request,@PathVariable ("Id") int Id) {/ / Code Block} Information from the Internet

@ PathVariable to get variables from the path

@ RequestParam is to get parameters from the request.

Thank you for reading this article carefully. I hope the article "what to do when the SpringMVC Project visits controller" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Configuration time friends article path project say error what to do reason console method static control no clear enumerate one by one code value all Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MariaDB Microsoft Shulou Information MySQL