Time for action – examining request mapping
Let's observe what will happen when you change the value attribute of the @RequestMapping annotation by executing the following steps:
Open your STS and run the webstore project; just right-click on your project and choose Run As | Run on Server. You will be able to view the same welcome message on the browser.
Now, go to the address bar of the browser and enter the URL,
http://localhost:8080/webstore/welcome.You will see the HTTP Status 404 error page on the browser, and you will also see the following warning in the console:
WARNING: No mapping found for HTTP request with URI [/webstore/welcome] in DispatcherServlet with name ' DefaultServlet'
An error log displaying the "No mapping found" warning message
Now, open the
HomeControllerclass, change the@RequestMappingannotation'svalueattribute to/welcome, and save it. Basically, your new request mapping annotation will look like@RequestMapping("/welcome").Again, run the application and enter...