Of Templates and Ajax
On second thought, instead of cleaning up the list and show views, let’s just set them aside and create a new view that will replace them both. To do that, we’ll take advantage of Grails’ GSP templates.
GSP templates are simply chunks of GSP code in a file that begins with an underscore (_likethis.gsp). They provide an easy way to share common code across multiple pages (Grails’ use of the _form.gsp template for our create and edit views is a great example of this). You can include a template in a GSP page with the <g:render> tag, like this:
| | <g:render template="someTemplate" /> |
This line would render a template called _someTemplate.gsp in the same directory as the page that it is being called from. To render ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access