Skip to main content

Controller Layer

Learn Controller Layer (Spring MVC + Database, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes Controller layer receives HTTP requests, calls the service layer and returns a view name or a response body. @Controller returns view names for HTML pages; @RestController returns data (usually JSON) written straight to the response. Mapping annotations such as @GetMapping and @PostMapping connect URLs and HTTP methods to methods.

More lessons in Spring MVC + Database