-
Book Overview & Buying
-
Table Of Contents
Grails 1.1 Web Application Development
By :
Grails supports a service layer that allows us to extract the logic of our application from controllers into reusable and testable services. This means that controllers can focus on controlling the application flow, rather than becoming cluttered with business logic.
Service classes are defined by another convention:
They must exist under the grails-app/services folder.
The class name must end in Service.
As with controllers and domain classes, Grails provides a command-line tool to generate service classes. In the terminal window run:
grails create-service app.File
This will create the Groovy class grails-app/service/app/FileService.groovy with the following code:
package app
class FileService {
boolean transactional = true
def serviceMethod() {
}
}
Grails uses Spring's support for declarative transactions to allow all service methods to be transactional. If we decide that we don't want a service to be transactional, then we must declare the transactional property as false...
Change the font size
Change margin width
Change background colour