Thymeleaf fragments when used together with Java Reflection can be used to generate pages easily in a consistent way. This blog post is on the demonstration code hosted at https://github.com/jansjay/thymeleaf-fragments-java-reflection