Моя форма тимелеафа не принимает входной longUrl. Когда я запускаю приложение при отладке, оно встречает почтовый запрос ниже со знаком "". Как я могу заставить его принимать данные формы и отправлять их в теле?
![enter image description here](https://i.stack.imgur.com/19QSl.png)
![enter image description here](https://i.stack.imgur.com/8qOrS.png)
Форма тимелиста:
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form method="POST" th:action="@{create_short_url_thymeleaf}">
<h1>Hit Enter to Shorten Your Long Url</h1>
<input type="text" th:name="longUrl"/>
</form>
</body>
</html>
Даже когда я пытаюсь ввести значение вручную, оно все равно не попадает в контроллер
<input type="text" name="longUrl" value="somelongurl"/>
Код контроллера :
@Controller
@RequestMapping("/api/v1")
public class UrlShorteningController {
@GetMapping("/create_short_url")
public String newShortUrl(Model model) {
model.addAttribute("longUrl",
"");
return "some-form";
}
@PostMapping("/create_short_url_thymeleaf")
ResponseEntity<String> newShortUrlFromThymeleaf(@ModelAttribute String longUrl) {
// Running the application on debug, I make it here, but the longUrl is empty.
....
}