【问题标题】:calling constructor of PagedResultList GrailsPagedResultList Grails 的调用构造函数
【发布时间】:2012-08-16 16:21:08
【问题描述】:

我正在尝试调用 PagedResultList 的构造函数:

def result = new PagedResultList(list: q, totalCount:q.size())

其中 q 是我的 ArrayList,但我收到一条错误消息,提示无法解析类。我以为 PagedResultList 类在 grails 库中,为什么会出现此错误。我正在运行 grails 1.3.7

【问题讨论】:

    标签: grails constructor pagedlist


    【解决方案1】:

    您需要导入 - Grails 中没有额外的自动导入的包或类,除了 Groovy 支持的:

    import grails.orm.PagedResultList
    

    你的地图构造函数也不能工作,因为这个类有一个真正的参数化构造函数;你需要这样做:

    def result = new PagedResultList(q, q.size())
    

    【讨论】:

      猜你喜欢
      • 2011-10-09
      • 1970-01-01
      • 2011-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-08
      • 2021-11-23
      • 2019-01-10
      相关资源
      最近更新 更多