Thymeleaf Whitelabel Error Page – Convert html to thymeleaf template

Although , browsers are very forgiving in nature and ignore incomplete tags, but Thymeleaf blow out if it finds document to be not well structured xml document, and if we donot follow these rules, thymeleaf gonna be very angry with us, so lets understand those tweaks.

 

XML Namespace

Add xml namespace for thymeleaf

<html lang="en"> to <html lang="en" xmlns:th="http://www.thymeleaf.org">

Meta Tag

The element type “meta” must be terminated by the matching end-tag “</meta>”

<meta charset="utf-8" > to <meta charset="utf-8" />

Image Tag

Although browser ignores these, we have to do it for thymeleaf.

<img src='//imagehosting.domain.com/imageid3' > to <img src='//imagehosting.domain.com/imageid3' />

 

Link Tag

<link href='//imagehosting.domain.com/bootstrap.min.css' rel="stylesheet" > 
to 
<link href='//imagehosting.domain.com/bootstrap.min.css' rel="stylesheet"  />

 

Error : The content of elements must consist of well-formed character data or markup.

< script type="text/javascript"  >
 window.jQuery || document.write("<script src='assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
< / script >
to
You need to add CDATA tags for the script like this
< script type="text/javascript"  >
    //<![CDATA[
     window.jQuery || document.write("<script src='assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
    //]]>
</ script >

Eclipse Thymeleaf Intellisense Installation

In Eclipse, go to Help >> Install New Software… then either use the update site URL, or download a ZIP archive of the plugin from SourceForge:

Advertisements

Tagged: , , , , , , ,

One thought on “Thymeleaf Whitelabel Error Page – Convert html to thymeleaf template

  1. Mukesh February 21, 2017 at 7:29 pm Reply

    Thanks it is helpful

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: