Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added API for previous versions


First, we're going to include a fragment that's already written. Change the code of your helloWorld.gsp to

Uiframework version 1.8+:

Code Block
${ ui.includeFragment("uiframework", "helloUser") }

Earlier versions:

Code Block

${ ui.includeFragment("helloUser") }

Now reload the page, and you should see a simple welcome message.

You're probably wondering what "ui" is. Since Groovy templates do not support tag libraries, we have collected a bunch of useful functionality in the "ui" object.

ui.includeFragment ("yourmodule", "fragmentName") tells the UI framework to evaluate the given fragment and return its HTML as a String. Since we want to insert this into the page, we use the dollar-curly-brace construct to wrap the Groovy code.