Proste pytanie: Mam klasę usług (powiedzmy helpersService
) i metodę def constructURI(params)
. Jak mogę wywołać tę metodę z widoku szablonu.Jak wywołać usługę Grails w widoku?
Próbowałem następujący kod bez powodzenia
<% def helpersService = new HelpersService() // or def helpersService
%>
<img src="${helpersService. constructURI(params)}"/>
Ale pojawia się następujący wynik:
No signature of method: com.HelpersService. constructURI() is applicable for argument types...
lub (w przypadku używam def helpersService
)
Cannot invoke method constructURI() on null object
pomysłów ?
tutaj odpowiedzi: http://stackoverflow.com/questions/2510929/how-do-i-call-a-grails-service-from-a-gsp/19378586#19378586 –