Нет подписи метода: java.lang.String.encodeAsLineBreak() groovy / grails

#grails #groovy #gsp

#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. Итак, что вы делаете вокруг строки 441 из index.gsp ?

Ответ №1:

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 Encoding and Decoding Objects