Merge branch 'master' of git://github.com/jgarciaheredero/tutorials into jgarciaheredero-master

# Conflicts:
#	spring-mvc-java/pom.xml
This commit is contained in:
Grzegorz Piwowarek
2016-10-04 17:02:21 +02:00
6 changed files with 211 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
package com.baeldung.web.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
@RequestMapping("/message")
public class MessageController {
@RequestMapping(value = "/showForm", method = RequestMethod.GET)
public String showForm() {
return "message";
}
@RequestMapping(value = "/processForm", method = RequestMethod.POST)
public String processForm(@RequestParam("message") final String message, final Model model) {
model.addAttribute("message", message);
return "message";
}
}