(Quick Reference)

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)] } }

Example usages for above controller:

<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]" />

Example as a method call in a controller, tag library or GSP:

def content = g.include(action: 'list', controller: 'book')

詳細
Description

属性

Attributes
  • action (optional) - the name of the action to use in the include
  • controller (optional) - the name of the controller to use in the include
  • id (optional) - the id to use in the include
  • view (optional) - The name of the view to use in the include
  • params (optional) - a Map of request parameters
  • model (optional) - Any request attributes (the model) to pass to the view to be included

ソース
Source

{source:tag=RenderTagLib.include} {source}