Commit a1735cf4 by Patryk Czarnik

Rozmowa - odbiór parametru

parent 3ce13520
package com.example.demo; package com.example.demo;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@Controller @Controller
public class RozmowaController { public class RozmowaController {
@RequestMapping("/rozmowa") @RequestMapping("/rozmowa")
public String rozmowa() { public String rozmowa(String imie, Model model) {
System.out.println("Przysłane imię: " + imie);
model.addAttribute("powitanie", "Witaj " + imie);
return "rozmowa.html"; return "rozmowa.html";
} }
......
...@@ -14,5 +14,7 @@ ...@@ -14,5 +14,7 @@
<button>OK</button> <button>OK</button>
</form> </form>
<p th:text="${powitanie}">Lorem ipsum</p>
</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