[BAEL-2851] Debugging the Spring MVC 404 “No mapping found for HTTP request with URI...” error
This commit is contained in:
parent
6b76d5ed0e
commit
68413d30dc
|
@ -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";
|
||||||
|
}
|
||||||
|
}
|
|
@ -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>
|
Loading…
Reference in New Issue