How to call a service from a controller in grails

I have a service class, and I'm trying to call the service method in my controller, as shown below.

class LogListController { def ListLogDetails = { println "We are inside List log Details-->"+params def logListHelperService logListHelperService.getFilePath(params) }} 

Exception message: Cannot call getFilePath () method on null object

what is my mistake.

+4
source share
1 answer
 def logListHelperService 

must be declared outside of the ListLogDetails definition

 def logListHelperService def ListLogDetails = { println "We are inside List log Details-->"+params logListHelperService.getFilePath(params) } 

must work

+11
source

All Articles