Haupz Blog

... still a totally disordered mix

HTMX

2026-11-15 — Michael Haupt

How about an alternative to React and all the client-side JavaScript?

Having worked with and on Java a lot, I feel somewhat sad about Java being present mostly in the far, far backend, and about frontends and immediate frontend services being written mostly in JavaScript. I don’t mean that judgmentally: this ecosystem is powerful and drives a lot of successful web applications, including our own. But can’t a lot more be done with Java?

The idea, in principle, is this: instead of implementing logic in the browser, implement it on the server side, and send actions and bits of server-rendered HTML back and forth. Interactions on the client side send requests to the server. The server’s responses are bits of HTML that are used to replace existing elements in the DOM. Upside: much less JavaScript wielding, no NPM, no hassle with React versions. Downside: possibly more communication with the server, no easy way to do an offline mode.

Reading about the Hotwire framework used in Ruby on Rails (in particular, its Turbo component supporting sending HTML over the wire to build dynamic applications) got me started. Is there something like this in the Java world, and equally well embedded in a state-of-the-art ecosystem?

It turns out there’s HTMX. It’s a bit more low-level than Turbo, which isn’t a problem. Also, it integrates well with Spring Boot. Nice.

Tags: hacking