Have you implemented OpenMRS? Please participate in the Implementation Site Survey. If you already have, thank you!
Now we're going to introduce the most important part of the OpenMRS UI Framework: "fragments". Basically, we want to make every effort to break down our UI into fragments of pages. This has two key benefits:
First, we're going to include a fragment that's already written. Change the code of your helloWorld.gsp to
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. (Your module can provide a utility function like this too.)
ui.includeFragment 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.
The first argument to ui.includeFragment is a "fragment provider", which 99% of the time is the module id of the module the fragment is defined in. The second argument is the fragment name.
The uiframework module only contains this single helloUser fragment for test purposes. The uilibrary module includes standard helpful fragments.