是什麼我做錯了,我無法給JSON對象從Grails的控制器傳遞給Grails的服務。無法從Grails的控制器傳遞的JSONObject到Grails的服務
class SampleController {
def sampleService
def updateProduct() {
def jq = request.JSON
sampleService(jq)
}
}
class SampleService {
def updateProduct (JSONObject requestJSON) {
if (!requestJSON) {
return null;
}
}
}
法無簽名:com.SampleService.call()
適用於參數類型:(org.codehaus.groovy.grails.web.json.JSONObject)
值:
可能的解決方案:
wait()
,any()
,wait(long)
,any(groovy.lang.Closure)
,each(groovy.lang.Closure
),find()
。
Stacktrace如下:
你發佈的堆棧跟蹤? – 2013-03-01 16:32:07
錯誤2013-03-01 10:15:45,056 [http-bio-8080-exec-4] ERROR errors.GrailsExceptionResolver - 處理請求時發生MissingMethodException: 方法的無簽名:com.SampleService.call()適用於參數類型:(org.codehaus.groovy.grails.web.json.JSONObject)values:可能的解決方案:wait(),any(),wait(long),any(groovy.lang.Closure),each(groovy.lang .Closure),find()。 Stacktrace如下: – 2013-03-01 16:37:00
我猜'sampleService(jq)'應該是'sampleService.updateProduct(jq)'。 – moeTi 2013-03-01 16:42:07