Grails分页标记错误 [英] Grails pagination tag error

查看:155
本文介绍了Grails分页标记错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我点击分页按钮时出现此错误:

错误处理GroovyPageView:标记[paginate]缺少/ home / user1 / workspace / adm- appserver-manager / grails-app / views / emailNotification / status.gsp:59

i have this error when i click on the pagination button:
Error processing GroovyPageView: Tag [paginate] is missing required attribute [total] at /home/user1/workspace/adm-appserver-manager/grails-app/views/emailNotification/status.gsp:59

我的代码是:
in gsp: p>

and my code is: in gsp:

<div class="paginateButtons">  
           <g:paginate total="${emailNotificationInstanceTotal}" />  

</div>

在控制器中:

in controller:

def status = {
    [
        emailNotificationInstanceList:EmailNotification.findAllByStatus(EmailNotification.Status.Sent, params ),
        emailNotificationInstanceTotal:EmailNotification.countByStatus(EmailNotification.Status.Sent)  
    ]
}

我提到了总属性,但我不知道为什么出现此错误

i mention total attribute but i don't know why this error appear

推荐答案

确保您的控制器在返回或呈现中返回此参数。

Make sure that your controller is returning this parameter in your return or render. You should also add a default value in your controller or view, in case the source call fails.

<g:paginate total="${emailNotificationInstanceTotal?:0}" />



Or

emailNotificationInstanceTotal: EmailNotification.countByStatus(EmailNotification.Status.Sent)?:0

这篇关于Grails分页标记错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆