include
目的 Purpose
Includes the response of another controller/action or view in the current response使用例 Examples
Example controller for an application called "shop":class BookController { def list() { [books: Book.list(params)] } def show() { [book: Book.get(params.id)] } }
<g:include action="show" id="1" /><g:include action="show" id="${currentBook.id}" /><g:include controller="book" /><g:include controller="book" action="list" /><g:include action="list" params="[sort: 'title', order: 'asc', author: currentBook.author]" />
def content = g.include(action: 'list', controller: 'book')
詳細 Description
属性 Attributes
action
(optional) - the name of the action to use in the includecontroller
(optional) - the name of the controller to use in the includeid
(optional) - the id to use in the includeview
(optional) - The name of the view to use in the includeparams
(optional) - a Map of request parametersmodel
(optional) - Any request attributes (the model) to pass to the view to be included