BAEL-1088 / fix / RequestMapping is replaced with GetMapping (#2640)

* RequestMapping is replaced with GetMapping

* Update PassParametersController.java
This commit is contained in:
ahmetcetin39 2017-09-20 16:54:10 +03:00 committed by Grzegorz Piwowarek
parent 771ded6b03
commit 01dddf49c0
1 changed files with 5 additions and 6 deletions

View File

@ -3,8 +3,7 @@ package org.baeldung.controller.controller;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
/** /**
@ -16,23 +15,23 @@ import org.springframework.web.servlet.ModelAndView;
*/ */
@Controller @Controller
public class PassParametersController { public class PassParametersController {
@RequestMapping(value = "/showViewPage", method = RequestMethod.GET) @GetMapping("/showViewPage")
public String passParametersWithModel(Model model) { public String passParametersWithModel(Model model) {
model.addAttribute("message", "Baeldung"); model.addAttribute("message", "Baeldung");
return "viewPage"; return "viewPage";
} }
@RequestMapping(value = "/printViewPage", method = RequestMethod.GET) @GetMapping("/printViewPage")
public String passParametersWithModelMap(ModelMap map) { public String passParametersWithModelMap(ModelMap map) {
map.addAttribute("welcomeMessage", "welcome"); map.addAttribute("welcomeMessage", "welcome");
map.addAttribute("message", "Baeldung"); map.addAttribute("message", "Baeldung");
return "viewPage"; return "viewPage";
} }
@RequestMapping(value = "/goToViewPage", method = RequestMethod.GET) @GetMapping("/goToViewPage")
public ModelAndView passParametersWithModelAndView() { public ModelAndView passParametersWithModelAndView() {
ModelAndView modelAndView = new ModelAndView("viewPage"); ModelAndView modelAndView = new ModelAndView("viewPage");
modelAndView.addObject("message", "Baeldung"); modelAndView.addObject("message", "Baeldung");
return modelAndView; return modelAndView;
} }
} }