Book Image

Spring MVC Beginner's Guide

By : Amuthan Ganeshan
Book Image

Spring MVC Beginner's Guide

By: Amuthan Ganeshan

Overview of this book

Table of Contents (19 chapters)
Spring MVC Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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:

  1. 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.

  2. Now, go to the address bar of the browser and enter the URL, http://localhost:8080/webstore/welcome.

  3. 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

  4. Now, open the HomeController class, change the @RequestMapping annotation's value attribute to /welcome, and save it. Basically, your new request mapping annotation will look like @RequestMapping("/welcome").

  5. Again, run the application and enter...