If you're interested in Java template engines for the client side (SPAs), you can look at Flavour: https://flavour.sourceforge.io/
While templates are a big part of Flavour, it also includes routing, components, and idiomatic invocation of Java services.
The book on Flavour is here: https://frequal.com/Flavour/book.html
Example 5-letter word game single-page app made with 100% Java, 100% Flavour: https://frequal.com/wordii/
Also, for SPA with SSR take a look at Double View https://github.com/emeraldpay/double-view
It's a React renderer that works on Java backend by using GraalVM, and then the same JS template continues to work in browser.