Commit f770f388 by Patryk Czarnik

początek przykłady BLOG

parent 670ad644
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;
@Controller
@RequestMapping("/blog")
public class BlogController {
@GetMapping
public String rozmowaGet() {
return "blog.html";
}
@PostMapping
public String rozmowaPost(String tekst, Model model) {
if(tekst != null && !tekst.isBlank()) {
}
return "blog.html";
}
}
<!DOCTYPE html>
<html lang="pl" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Blog</title>
<link rel="stylesheet" type="text/css" th:href="@{/styl.css}" href="../static/styl.css">
</head>
<body>
<h1>Blog - wersja webowa</h1>
<form method="post">
<label for="tekst">Napisz coś:</label><input id="tekst" name="tekst" type="text"><br>
<button>OK</button>
</form>
<section>
<h2>Zapamiętane teksty:</h2>
<ul>
<li>przykładowy tekst</li>
</ul>
</section>
</body>
</html>
...@@ -41,5 +41,11 @@ ...@@ -41,5 +41,11 @@
<li><a th:href="@{/kalkulator}">Kalkulator</a></li> <li><a th:href="@{/kalkulator}">Kalkulator</a></li>
</ul> </ul>
<h2>Przykład Blog</h2>
<ul>
<li><a th:href="@{/blog}">Formularz</a> do wpisywania tekstów</li>
</ul>
</body> </body>
</html> </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