我实现了POGO类的跟随列表方法
def list (def sort=null, def order=null, def max=null, def offset=null) {
..
}
当我从控制器调用它时
render view: 'index', model: [orderList: Order.list(params.sort, params.order, params.max, params.offset), orderCount:orders.size()]
我收到了以下错误
No signature of method: static mypackage.Order.list() is applicable for argument types: (null, null, null, null) values: [null, null, null, null]
Possible solutions: list(), wait(), find(), list(java.lang.Object), list(java.lang.Object, java.lang.Object), list(java.lang.Object, java.lang.Object, java.lang.Object). Stacktrace follows:
Message: No signature of method: static latis.ctl.Job.list() is applicable for argument types: (null, null, null, null) values: [null, null, null, null]
Possible solutions: list(), wait(), find(), list(java.lang.Object), list(java.lang.Object, java.lang.Object), list(java.lang.Object, java.lang.Object, java.lang.Object)
Line | Method
->> 6 | showInstances in latis.ctl.JobController
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 198 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter . . in grails.plugin.cache.web.filter.AbstractFilter
| 53 | doFilter in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
| 49 | doFilter . . in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
| 82 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 1145 | runWorker . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run . . . . . in java.lang.Thread
java.lang.Object), list(java.lang.Object, java.lang.Object, java.lang.Object)
答案 0 :(得分:0)
堆栈跟踪和控制器代码显示您正在调用静态方法(在类而不是实例上调用方法)。显示定义的方法是实例方法。你没有调用你定义的方法。
如果您打算将它作为静态方法,可以使用static def
定义方法。