没有方法签名:java.lang.String.encodeAsLineBreak()groovy / grails

时间:2011-11-10 22:51:16

标签: grails groovy gsp

我正在尝试调试gsp页面,但是我收到以下错误:

Error 500:   
Servlet: default  
URI: /iucentral/QAInfo/list
Exception Message: No signature of method: java.lang.String.encodeAsLineBreak() is applicable for argument types: () values: [] 
Caused by:
  Error processing GroovyPageView:
  Error executing tag <g:form>:
  Error evaluating expression [QAInfoInstance.fromTables.encodeAsHTML().encodeAsLineBreak()] on line [428]: 
    groovy.lang.MissingMethodException: No signature of method: java.lang.String.encodeAsLineBreak() is applicable for argument types: () values: []
    at D:/Users/psouzamo/Documents/workspace-sts-2.7.2.RELEASE/uicentral/grails-app/views/QAInfo/list.gsp:441  
Class: list.gsp   
At Line: [446]  
Code Snippet:  

1 个答案:

答案 0 :(得分:2)

LineBreak不是标准的Grails编解码器,因此请确保在grails / utils文件夹中正确定义了自定义编解码器。

class LineBreakCodec {
    static encode = { str ->
        // convert the string and return the result
    }
}

请参阅11.2末尾的自定义编解码器部分 http://grails.org/doc/latest/guide/single.html#11.2%20Encoding%20and%20Decoding%20Objects