Adding a <hr> tag causes Exception

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding a <hr> tag causes Exception

Esteve Graells
I really like ThymeLeaf (TL), and while playing with PetClinic (Spring+TL) just added a <hr> close to the end of the welcome.html file as follows, and an Exception has been thrown:

        </div>
        <hr>   <----------------------Added this here
    </body>
</html>

SEVERE: El Servlet.service() para el servlet [petclinic] en el contexto con ruta [/petclinic] lanzó la excepción [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Exception parsing document: template="welcome", line 31 - column 7] con causa raíz

Does anybody knows why this happened?

Thanks in advance,
Esteve.

PD: Daniel muchas felicidades por TL
Reply | Threaded
Open this post in threaded view
|

Re: Adding a <hr> tag causes Exception

Zemi
Administrator
Depending on your configuration, Thymeleaf expects well-formed XML.

Try writing
   <hr />
instead of
   <hr>

Reply | Threaded
Open this post in threaded view
|

Re: Adding a <hr> tag causes Exception

danielfernandez
Administrator
In reply to this post by Esteve Graells

Hi,

Check your template mode. If you are using XHTML, that syntax is invalid (should be "<hr />"). In Thymeleaf's "HTML5" template mode, only xml-valid syntax is allowed, so you would need "<hr />" too. If you want to be able to use non-XML-valid syntax, you should be using the LEGACYHTML5 template mode.

My recommendation is to always use xml-valid syntax. See http://www.thymeleaf.org/fromhtmltohtmlviahtml.html

Regards,
Daniel.