From the course: Complete Guide to Spring MVC

Unlock this course with a free trial

Join today to access over 24,600 courses taught by industry experts.

Create a web controller

Create a web controller

- [Instructor] Okay. So now we want to create our web controller. To start off, for those that ran their application earlier, go ahead and stop your server, and then right-click into our main class here. Go to New, and we want to create a new Java class. Let's name this Java class GreetingController. So type in GreetingController. There you go. Select Enter. Go into our GreetingController. Okay. If you skipped the basics, you may already have this, but for those that are going step by step, let's follow along. So what we're going to do is go ahead above our public class here, we're going to add the annotation of Controller. You can go ahead and select that there. And you see above, we have controller imported for us. And when you hover over any of the annotation, it gives you some helpful information as well as links that you can go into if you would like to dig deeper, okay? All right, let's go into our public class here. Go ahead and use GetMapping. I'm go ahead and let you know…

Contents