I have a grails app named qotd which has a controller named quote. I have written view file for this controller named as random.gsp file as :
<html>
<head>
<title>Random Quote</title>
</head>
<body>
<div id ="quote">
<q>${content}</q>
<p>${author}</p>
</div>
</body>
Now i have to write down the Grails Layout for this controller. For example i have to locate my .css and images files etc, how to do that(better if an example is shown)? And where i should place that file?
Thanks in advance.
When you create a Grails application with
grails create-app qotd, you get a filegrails-app/views/layout/main.gsp. Take a look at that file, as it shows you how to include css, js and images. This file is the default Sitemesh layout file. To use it, change your random.gsp toThen the layout file main.gsp will be wrapped around your content.
To learn more about Sitemesh, take a look at chapter 7 in the Grails documentation