October 2017
Intermediate to advanced
396 pages
10h 2m
English
Let's create a controller class for our bank application. HomeController is a controller class that handles requests for / and renders the homepage of the bank application:
package com.packt.patterninspring.chapter10.bankapp.web.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class HomeController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home (){
return "home";
}
}
As you can see in the preceding code, the HomeController class contains the home() method. It is a handler method, because it is annotated with the
Read now
Unlock full access