簡単な質問:サービスクラス(たとえばhelpersService
)とメソッドがありdef constructURI(params)
ます。テンプレートビューからこのメソッドを呼び出すにはどうすればよいですか。
次のコードを試しましたが成功しませんでした
<% 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
何か案は?