grails-视图定义中生成的实例

grails-视图定义中生成的实例,grails,model-view-controller,groovy,Grails,Model View Controller,Groovy,generate all in grails将与View(CRUD)一起生成一个控制器,我试图了解生成的每个代码块的影响,现在我似乎在index.gsp中找不到{accountInstanceList}的定义 /views/account/index.gsp <g:each in="${accountInstanceList}" status="i" var="accountInstance"> <tr class="${(i % 2)

generate all in grails将与View(CRUD)一起生成一个控制器,我试图了解生成的每个代码块的影响,现在我似乎在index.gsp中找不到{accountInstanceList}的定义

/views/account/index.gsp

        <g:each in="${accountInstanceList}" status="i" var="accountInstance">
            <tr class="${(i % 2) == 0 ? 'even' : 'odd'}">

                <td><g:link action="show" id="${accountInstance.id}">${fieldValue(bean: accountInstance, field: "firstname")}</g:link></td>

                <td>${fieldValue(bean: accountInstance, field: "middlename")}</td>

                <td>${fieldValue(bean: accountInstance, field: "lastname")}</td>

                <td>${fieldValue(bean: accountInstance, field: "email")}</td>

                <td>${fieldValue(bean: accountInstance, field: "role")}</td>

            </tr>
        </g:each>

{accountInstanceList}不在控制器的索引操作中,它是在哪里定义的?是否也生成了隐藏类?

渲染方法会找出您试图传递给视图的“对象”的类型,并创建一个合适的名称,如果是域对象列表,则为DomainNameInstanceList,请参见类
DefaultHtmlRenderer

另请参见文档的一节

...the standard scaffold views expect model variables of the form
<propertyName>InstanceList for collections and <propertyName>Instance
for single instances
…标准scaffold视图需要表单的模型变量
集合和实例的InstanceList
对于单个实例

render方法计算出您试图传递给视图的“对象”的类型,并创建一个合适的名称,如果是域对象列表,则为DomainNameInstanceList,请参见类
DefaultHtmlRenderer

另请参见文档的一节

...the standard scaffold views expect model variables of the form
<propertyName>InstanceList for collections and <propertyName>Instance
for single instances
…标准scaffold视图需要表单的模型变量
集合和实例的InstanceList
对于单个实例

换句话说,我将看不到实例的物理定义?你所说的“看”是什么意思?我的意思是,我无法转到accountInstanceList的定义?不是这样,而是手动返回
[accountInstanceList:Account.findAllBy(params)]
或域上返回列表的其他方法我很感激,为我节省了很多时间换句话说,我不会看到实例的物理定义?你所说的“看到”是什么意思?我的意思是我无法访问accountInstanceList的定义?不是这样的,它是沿着手动返回的路线进行的
[accountInstanceList:Account.findAllBy(params)]
或域上返回列表的其他方法我很感激,为我节省了很多时间