diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GreetingController.java b/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GreetingController.java new file mode 100644 index 0000000000..dfa50fcb26 --- /dev/null +++ b/spring-mvc-xml/src/main/java/com/baeldung/spring/controller/GreetingController.java @@ -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"; + } +} \ No newline at end of file diff --git a/spring-mvc-xml/src/main/webapp/WEB-INF/view/greeting.jsp b/spring-mvc-xml/src/main/webapp/WEB-INF/view/greeting.jsp new file mode 100644 index 0000000000..ac17c75ab7 --- /dev/null +++ b/spring-mvc-xml/src/main/webapp/WEB-INF/view/greeting.jsp @@ -0,0 +1,9 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + +
+