Sending data to Thymeleaf (HTML) from Spring-Boot MVC (Java), Not being displayed
16:48 16 Mar 2026

I am trying to put a front end on some Java code, I have added a Spring Controller Class. The only code that matters is the viewHomePage method. The Employee Class and allemplist attribute, both commented out shows what is eventually intended with the table.

package money.pension1;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

//import java.util.List;

@Controller
public class StackController {
 /*
 static class Employee {
    private static long count =0;

    private long id;
    private String name;
    private String email;
    Employee(String name, String email){
        id = ++count;
        this.name =name;
        this.email = email;
    }
    Employee(String name) {
        this(name, name + "@business.com");
    }

    @Override
    public String toString(){
        return String.format("%d %s", id, name);
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
}

  */
    @GetMapping("/")
    public String viewHomePage(Model model) {
        model.addAttribute("name", "Mega Corp");
//        model.addAttribute("allemplist", List.of(new Employee("Fred"), new Employee("Bob"),
//                new Employee("Bill"), new Employee("Mary")));
        return "index.html";
    }
}

This seem to work and I can get communication from the web-page to the Java code, including data, and the response going out seem correct however I can not get the HTML to display the results

Spring Debug Messages

2026-03-15T18:50:01.388Z DEBUG 195840 --- [pension1] [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : GET "/", parameters={}
2026-03-15T18:50:01.397Z DEBUG 195840 --- [pension1] [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to money.pension1.MainController#viewHomePage(Model)
2026-03-15T18:50:01.422Z DEBUG 195840 --- [pension1] [nio-8080-exec-1] o.s.w.s.v.ContentNegotiatingViewResolver : Selected 'text/html' given [text/html, application/xhtml+xml, image/avif, image/webp, image/apng, application/xml;q=0.9, */*;q=0.8, application/signed-exchange;v=b3;q=0.7]
2026-03-15T18:50:01.423Z DEBUG 195840 --- [pension1] [nio-8080-exec-1] o.s.w.servlet.view.InternalResourceView  : View name [index.html], model {name=Mega Corp, allemplist=[1 Fred, 2 Bob, 3 Bill, 4 Mary]}
2026-03-15T18:50:01.425Z DEBUG 195840 --- [pension1] [nio-8080-exec-1] o.s.w.servlet.view.InternalResourceView  : Forwarding to [index.html]
2026-03-15T18:50:01.428Z DEBUG 195840 --- [pension1] [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : "FORWARD" dispatch for GET "/index.html", parameters={}
2026-03-15T18:50:01.432Z DEBUG 195840 --- [pension1] [nio-8080-exec-1] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped to ResourceHttpRequestHandler [classpath [META-INF/resources/], classpath [resources/], classpath [static/], classpath [public/], ServletContext [/]]
2026-03-15T18:50:01.442Z DEBUG 195840 --- [pension1] [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Exiting from "FORWARD" dispatch, status 200
2026-03-15T18:50:01.445Z DEBUG 195840 --- [pension1] [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed 200 OK

I have tried different way of reading the data in Thymeleaf but none seem to work





    
    Title


Employee List for data-th-test="${name}" th:value="${name}" [(${name})]"

Add Employee
Name Email Id Action
Update

The span does not produced any output and the h3 does not insert any data

Employee List for th:text="${name}" th:value="${name}" [(${name})]"

I have tried data-th-test="${name}" without success.

spring-boot spring-mvc thymeleaf spring-thymeleaf