Learn Java for Web Development

(Tina Meador) #1

338 CHAPTER 7: Rapid Web Development with Grails


5.
6.
7.
8.
9.
10.<g:layoutTitle default="Grails"/>
11.
12.<link rel="shortcut icon" href="${resource(dir: 'images', file: 'favicon.ico')}"
type="image/x-icon">
13.
14.
15.
16.
17.
18.
19.
20.
21.


22.
23.
24.
25.
26.
27.
28.


   Lines 1 to 6: The main.gsp page starts with <!doctype html>. This is an HTML5
doc type. Grails supports HTML5 out of the box.
 Line 10: <g:layoutTitle> is used in layouts to render the contents of the title tag
of the decorated page. The <g:layoutTitle> tag substitutes the <title> from
the view that is being merged and links it in a style sheet and favicon that will be
used by all views.
 Line 17: The <g:layoutHead> tag merges in the contents of the target view’s
<head> section. <g:layoutHead> is used in layouts to render the contents of the
head tag of the decorated page.
 Line 22: <g:layoutBody> is used in layouts to output the contents of the body
tag of the decorated page. The <g:layoutBody> tag merges in the <body>
contents of the target view.
 Line 25: <g:javascript> includes JavaScript libraries and scripts and provides
a shorthand for inline JavaScript. Specifying a library tells the Ajax tags which
JavaScript provider to use.
Free download pdf