Commit 50604dd4 by Patryk Czarnik

@GetMapping, @PostMapping

parent 3b8a00ea
...@@ -2,18 +2,18 @@ package com.example.demo; ...@@ -2,18 +2,18 @@ package com.example.demo;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
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.bind.annotation.PostMapping;
@Controller @Controller
public class RozmowaController { public class RozmowaController {
@RequestMapping(path="/rozmowa", method=RequestMethod.GET) @GetMapping("/rozmowa")
public String rozmowaGet() { public String rozmowaGet() {
return "rozmowa.html"; return "rozmowa.html";
} }
@RequestMapping(path="/rozmowa", method=RequestMethod.POST) @PostMapping("/rozmowa")
public String rozmowaPost(String imie, Model model) { public String rozmowaPost(String imie, Model model) {
if(imie != null && !imie.isBlank()) { if(imie != null && !imie.isBlank()) {
model.addAttribute("message", "Witaj " + imie); model.addAttribute("message", "Witaj " + imie);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment