Spring boot 如何从不是pojo一部分的html传递字段?

Spring boot 如何从不是pojo一部分的html传递字段?,spring-boot,Spring Boot,在我的spring boot应用程序中: POJO: 此处为html模板: <!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <title th:text="${appName}">Template title</title> <link th:href="@{/public/style.css}" rel="stylesheet"/

在我的spring boot应用程序中:

POJO:

此处为html模板:

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title th:text="${appName}">Template title</title>
    <link th:href="@{/public/style.css}" rel="stylesheet"/>
</head>
<body>
<div id="container">
    <h2 align="center">Registration new user</h2>
    <form th:action="@{/registration.html}" method="post">
        <label for="username">Username</label>
        <input type="text" id="username" name="username" autofocus="autofocus"/>
        <label for="password">Password</label>
        <input type="password" id="password" name="password"/>
        <label for="retypePassword">Retype password</label>
        <input type="password" id="retypePassword" name="retypePassword"/>
        <input id="submit" type="submit" value="Registration"/>
    </form>
    <p th:if="${registrationError}" th:text="${registrationError}" class="error"></p>
</div>
</body>
</html>

模板标题
注册新用户
用户名
密码
验证登陆密码

如您所见,我从html中传递POJO
User
,并检查is
username
password
是否已填充。 美好的 但是我还需要检查
password
retypePassword
是否相等。 问题是,
retypePassword
不是POJO
User
的一部分(没有属性
retypePassword
)。
如何将
retypePassword
从html传递到方法
registartionNewUser
以检查
password
retypePassword

retypePassword
作为方法
registartionNewUser
中的另一个参数

public String registartionNewUser(User user, String retypePassword, Model model)

此帮助信息:公共字符串注册表项OnnewUser(用户-用户,模型模型,@RequestParam(name=“retypePassword”,required=true)字符串retypePassword)
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title th:text="${appName}">Template title</title>
    <link th:href="@{/public/style.css}" rel="stylesheet"/>
</head>
<body>
<div id="container">
    <h2 align="center">Registration new user</h2>
    <form th:action="@{/registration.html}" method="post">
        <label for="username">Username</label>
        <input type="text" id="username" name="username" autofocus="autofocus"/>
        <label for="password">Password</label>
        <input type="password" id="password" name="password"/>
        <label for="retypePassword">Retype password</label>
        <input type="password" id="retypePassword" name="retypePassword"/>
        <input id="submit" type="submit" value="Registration"/>
    </form>
    <p th:if="${registrationError}" th:text="${registrationError}" class="error"></p>
</div>
</body>
</html>
public String registartionNewUser(User user, String retypePassword, Model model)