I am using Spring and Thymeleaf. Thanks to xerx593, I was able to get it working so I updated this question to show the working code.
Here is my application class
package com.propfinancing.www;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import nz.net.ultraq.thymeleaf.layoutdialect.LayoutDialect;
@Controller
@SpringBootApplication
public class PfWebApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(PfWebApplication.class, args);
}
@Bean
public LayoutDialect layoutDialect() {
return new LayoutDialect();
}
@GetMapping("/page1.html")
public String page1() {
return "page1";
}
}
Next, I create a layout.html file in src/main/resources/templates/layout.html
<!DOCTYPE html>
<html lang="en" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<body>
This is the layout template
<div layout:fragment="content">
<p>This is were the content will go</p>
</div>
</body>
</html>
And fin ally, I created /ser/main/resources/templates/page1.html to use the template:
<!DOCTYPE html>
<html lang="en"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout}">
<body>
<div layout:fragment="content">
This is the content of page 1.
</div>
</body>
</html>
When I go to http://dev.propfinancing.com/www/page1.html, it gives me the template driven output I was expecting.
Thanks! Neil