Skip to content

danduke/constructor-test

Repository files navigation

constructor-test

This is mostly a blank project from create-app. The only files that really matter are

Basically this shows that:

  • Setting named fields in a constructor through a GroovyPageRenderer silently fails
  • Setting specific fields on a constructed object through a GroovyPageRenderer succeeds
  • Both succeed when following a more "normal" path of a "render" call

Note that the taglib is not actually necessary; the same thing happens if the service is called directly from the GSP.

Stackoverflow issue with discussion, some backstory, etc. is available here: https://stackoverflow.com/questions/68446060/named-map-constructors-do-not-work-in-grails-gsp-pagerenderer?noredirect=1#comment120991465_68446060

output

Web page output is not important in this demo application. The console output of running this is

--------------------------
Called from pageRenderer
Created null
Created Bob
pageRenderer complete
--------------------------
--------------------------
Called from normal
Created Alice
Created Bob
normal complete
--------------------------

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published