mercredi 28 février 2018

Why Did can't I send model? Spring Boot 2 - Thymealf

I can not open the registration page. If I delete the th:field page is displayed. How can I solve problem. I can not speak English well Thank you...

Error

 Whitelabel Error Page
    This application has no explicit mapping for /error, so you are seeing this as a fallback.
    Thu Mar 01 01:10:34 EET 2018
    There was an unexpected error (type=Internal Server Error, status=500).
    An error happened during template parsing (template: "class path resource [templates/register.html]")

Exception

org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/register.html]")

Register HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h3>Register</h3>
<form th:action="@{register}" method="post" th:object="${user}">

<input type="text"  th:field="*{username}">
<input type="text"  th:field="*{password}">
<input type="submit" value="Submit">
</form>
 </body>
</html>

Controller

@Controller
@RequestMapping("/")
public class UserController {

    @RequestMapping(value="", method=RequestMethod.GET)
    public String getHomePage()
    {
        return "home";
    }

    @RequestMapping(value="register",method=RequestMethod.GET)
    public String getRegisterPage(Model model)
    {
        model.addAttribute("user",new User());
        return "register";
    }

}




Aucun commentaire:

Enregistrer un commentaire