Commit 5fac3154 by Patryk Czarnik

@GetMapping @PostMapping

parent fbeaa7b0
......@@ -2,19 +2,21 @@ package com.example.demo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class RozmowaController {
@RequestMapping(path="/rozmowa", method=RequestMethod.GET)
@GetMapping("/rozmowa")
public String rozmowa() {
// w przypadku metody GET tylko wyświetlamy pusty formularz
return "rozmowa.html";
}
@RequestMapping(path="/rozmowa", method=RequestMethod.POST)
@PostMapping("/rozmowa")
public String rozmowa(String imie, Model model) {
// w przypadku metody POST pobieramy przysłane imię i umieszczamy powitanie na stronie
// (o ile imię zostało przysłane)
......
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