Commit 009f6ebd by Patryk Czarnik

Kalkulator - początek zadania

parent 7420a799
package org.example.demo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class KalkulatorController {
@GetMapping("/kalkulator")
public String dzialaj(Model model) {
// if(imie != null && !imie.isEmpty()) {
// String powitanie = "Witaj " + imie;
// model.addAttribute("powitanie", powitanie);
// }
return "kalkulator.html";
}
}
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Kalkulator</title>
<link rel="stylesheet" type="text/css" th:href="@{/styl.css}">
</head>
<body>
<h1>Kalkulator</h1>
<form method="get" class="kalkulator">
<input type="number" name="liczba1" th:value="${param.liczba1}">
<select name="operacja">
<option value="+">+</option>
<option value="-">-</option>
<option value="*">*</option>
<option value="/">/</option>
</select>
<input type="number" name="liczba2" th:value="${param.liczba2}">
<br>
<button>Oblicz</button>
</form>
<!-- miejsce na wynik -->
<div><a th:href="@{/}">wróć do strony głównej</a></div>
</body>
</html>
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