Grails - Groovy Server Pages



Description

The technology used to render the views in Grails framework for the client response is known as Groovy Server Pages (GSP) and is responsible for how to display the model to user.

Developing GSP is similar to JSP and it resides in views directory under grails-app.

GSPs can be rendered by using the render method as shown below:

render(view: "index")

Usually a GSP is a combination of mark-up and GSP tags and has a model consisting variables used to render a view. For instance, consider the controller given below:

def show() {
    [store: Store.get(params.id)]
}

The above code creates a model that has a key named store using which you can then reference it within the GSP view with the name store as shown below:

${store.title}
Advertisements