Commit 1c41c41a by Patryk Czarnik

@GetMapping @PostMapping

parent 8ccd7604
......@@ -2,18 +2,20 @@ 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
@RequestMapping("/kalkulator")
public class KalkulatorController {
@RequestMapping(path="/kalkulator", method=RequestMethod.GET)
@GetMapping
public String kalkulatorGet() {
return "kalkulator.html";
}
@RequestMapping(path="/kalkulator", method=RequestMethod.POST)
@PostMapping
public String kalkulatorPost(Long liczba1, Long liczba2, String operacja, Model model) {
if(liczba1 != null && liczba2 != null && operacja != null) {
Long wynik = switch(operacja) {
......
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