Add grails-htmx v8 guide#497
Merged
jamesfredley merged 1 commit intomasterfrom May 3, 2026
Merged
Conversation
Worked example for HTMX-driven interactive UI on a Grails 8 GSP backend.
A small task tracker with server-rendered initial page, then HTMX-driven
inline editing, live search, toggle, and optimistic delete with confirm.
Sample-app flavour. Greenfield (no upstream rename) - the new
grails-guides/grails-htmx repo was created public on the grails8
default branch.
The 14 chapters walk through:
- Getting Started (whatYouWillBuild, requirements, howto)
- Creating the Application
- The Task Domain Class
- Adding HTMX to the Layout (script tag with SRI hash)
- URL Mappings (explicit method per route)
- The TaskController (7 actions, 6 of which return GSP partials)
- The Initial Page (server-rendered first paint)
- The Row Partial (one template, four call sites)
- Inline Edit With Validation (422 returns the same edit fragment with
field errors rendered inline)
- Live Search (hx-trigger="keyup changed delay:300ms")
- CSRF With HTMX (htmx:configRequest hook reads token from a meta tag)
- HTMX vs an SPA (when each fits, cross-references the upcoming
grails-vite-spa guide)
Verified locally:
./gradlew validateGuides -PvalidationMode=both
[validateGuides] mode=both: 86 guide(s) parsed, 0 SKIP-warned, 0 errors
./gradlew renderGuide_grails_htmx_8 --rerun-tasks --no-configuration-cache
Renders all 14 chapter HTML pages, no Unresolved directive errors.
Assisted-by: claude-code:claude-opus-4-7
This was referenced May 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the HTMX with Grails 8 guide as the fifth Grails 8 sample-app-flavour guide and the second greenfield one (after the Tailwind PR #493). Following PRs #479, #493, #494, #495, #496.
A worked task tracker that demonstrates the HTMX recipe on a Grails 8 GSP backend: server-rendered first paint, then
hx-get/post/patch/deleteround-trips that swap small GSP partial fragments into well-defined slots in the DOM. No SPA, no JSON, no client-state framework.Greenfield - no upstream rename
The new
grails-guides/grails-htmxrepository was created public withgrails8as its default branch. There were no overlapping legacy repos to rename.What's in the PR
conf/guides.yml- newgrails-htmxregistry entry, alphabetical insertion betweengrails-google-homeandgrails-javamelody.guides/grails-htmx/v8/guide/*.adoc- 14 chapters.guides/grails-htmx/v8/snippets/- vendored Task domain, TaskController (7 actions), UrlMappings,main.gsplayout (with the HTMX 2.x script tag), and three GSP partials (_task.gsprow,_taskRows.gsplist,_taskEdit.gspedit form).Upstream sample app
grails-guides/grails-htmxon thegrails8branch contains the standardinitial/+complete/layout.initial/is a vanilla Grails 8webstarter.complete/adds the HTMX-driven task tracker.Verification
./gradlew validateGuides -PvalidationMode=bothreturns 86 guides, 0 errors../gradlew renderGuide_grails_htmx_8 --rerun-tasks --no-configuration-cacherenders all 14 chapter HTML pages, no Unresolved directive errors.Notes for reviewers
grails-vite-spaguide, which is the next PR in the series.htmx:configRequesthook for forwarding a Grails synchronizer token; the in-app sample app keeps the token plumbing minimal so the focus stays on the HTMX patterns.