[BAEL-2851] Debugging the Spring MVC 404 “No mapping found for HTTP request with URI...” error

This commit is contained in:
Kert Pjatkin 2019-08-29 12:53:03 +03:00
parent 6b76d5ed0e
commit 68413d30dc
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,16 @@
package com.baeldung.spring.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class GreetingController {
@RequestMapping(value = "/greeting", method = RequestMethod.GET)
public String get(ModelMap model) {
model.addAttribute("message", "Hello, World!");
return "greeting";
}
}

View File

@ -0,0 +1,9 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Greeting</title>
</head>
<body>
<h2>${message}</h2>
</body>
</html>