简单的问题:我有一个服务类(比如说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
有任何想法吗?