How to use layout of grails?
Define a layout file
There is a main.gsp file in view/layout by default. You can also define your own one.
The most important tags will be used to define a layout.
<g:layoutTitle>=> the title of the actual gsp file<g:layoutHead>=> the content of head of the actual gsp file<g:layoutBody>=> the content of body of the actual gsp file
The simplest layout file is like:
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<title><g:layoutTitle default="Blog"/></title>
<g:layoutHead/>
</head>
<body>
<g:layoutBody/>
</body>
</html>
To use the layout file
To use a layout file, just include <meta name="layout" value="name of layout file"> in the head of gsp files.
Only the head and body of gsp files will be merged into final results whereas DOCTYPE defined in gsp files won’t.






