spring mvc - Thymeleaf: Thymeleaf template parsing error -


i m doing password reset functionality , this,i using thymeleaf templates. here simple html,it not going render. tells me bellow error:

there unexpected error (type=internal server error, status=500). exception parsing document: template="demo", line 10 - column 

my thymeleaf configuration

@bean     public classloadertemplateresolver emailtemplateresolver(){         classloadertemplateresolver emailtemplateresolver = new classloadertemplateresolver();         emailtemplateresolver.setprefix("templates/mail/");         emailtemplateresolver.setsuffix(".html");         emailtemplateresolver.settemplatemode("html5");         emailtemplateresolver.setcharacterencoding("utf-8");         emailtemplateresolver.setorder(1);         return emailtemplateresolver;     } 

my demo.html is

<html xmlns:th="http://www.thymeleaf.org"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body> <form th:action="@{/resetpassword(_key=${resetpasswordtoken})}" method="post"> <div> <input type="password" th:field="*{password}"> <input type="password"> </div> </form> </body> </html>  

my controller

@requestmapping(value = "/resetpassword", method = requestmethod.get)       public string resetpasswordview( @requestparam(value = "_key") string resetpasswordtoken, final model model) {             system.out.println(resetpasswordtoken);             model.addattribute("resetpasswordtoken", resetpasswordtoken);             return "demo";       } 

i think it's simple html,it should render.so,please me missing here ?

thanks

by default, thymeleaf requires templates valid xml. haven't closed <input> tags when reaches </div> on line 10 fails tags unbalanced.

you can fix problem closing tag:

<input type="password" th:field="*{password}" /> 

alternatively, use thymeleaf's legacy html5 mode requires bit more setup.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -