BAEL-3012 Spring Request Parameters with Thymeleaf - move to new module

This commit is contained in:
mikr 2019-08-18 22:46:19 +02:00
parent 8470319d13
commit db1b7f1f14
3 changed files with 5 additions and 4 deletions

View File

@ -2,3 +2,4 @@
- [Working with Enums in Thymeleaf](https://www.baeldung.com/thymeleaf-enums)
- [Changing the Thymeleaf Template Directory in Spring Boot](https://www.baeldung.com/spring-thymeleaf-template-directory)
- [Spring Request Parameters with Thymeleaf](https://www.baeldung.com/spring-thymeleaf-request-parameters)

View File

@ -1,4 +1,4 @@
package com.example.demo;
package com.baeldung.thymeleaf.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@ -12,7 +12,7 @@ import static java.util.Arrays.asList;
@Controller
public class ParticipantController {
@RequestMapping("/")
@RequestMapping("/participants")
public String index(
@RequestParam(value = "participant", required = false) String participant,
@RequestParam(value = "country", required = false) String country,

View File

@ -4,7 +4,7 @@
</head>
<h2>Enter participant</h2>
<form th:action="@{/}">
<form th:action="@{/participants}">
<input type="text" th:name="participant"/>
<select name="country">
@ -25,7 +25,7 @@
<h2>Users</h2>
<th:block th:each="userId: ${userIds}">
<p>
<a th:href="@{/(id=${userId})}"> User [[${userId}]]</a>
<a th:href="@{/participants(id=${userId})}"> User [[${userId}]]</a>
</p>
</th:block>