簡単な質問: サービスクラス(helpersService
としましょう)とメソッドdef constructURI(params)
があります。 このメソッドをテンプレートビューから呼び出す方法はありますか。ビュー内でGrailsサービスを呼び出す方法は?
私は成功
<% def helpersService = new HelpersService() // or def helpersService
%>
<img src="${helpersService. constructURI(params)}"/>
せずに次のコードを試してみました。しかし、私は次のような結果を得る:任意のアイデア
No signature of method: com.HelpersService. constructURI() is applicable for argument types...
または(場合には、私はdef helpersService
を使用)
Cannot invoke method constructURI() on null object
を?
ここに答え http://stackoverflow.com/questions/2510929/how-do-i-call-a-grails-service-from-a-gsp/19378586#19378586 –