Question

I created a gsp page in the layout folder. The code is below:- layout->main.gsp

<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"><!--<![endif]-->
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title><g:layoutTitle default="Grails"/></title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="shortcut icon" href="${resource(dir: 'assets/ico', file: 'favicon.png')}" >
        <link rel="apple-touch-icon" href="${resource(dir: 'assets/ico', file: 'apple-touch-icon-57-precomposed.png')}">
        <link rel="apple-touch-icon" sizes="114x114" href="${resource(dir: 'assets/ico', file: 'apple-touch-icon-114-precomposed.png')}">
        <link rel="stylesheet" href="${resource(dir: 'dist/css', file: 'elastislide.css')}" type="text/css">
        <link rel="stylesheet" href="${resource(dir: 'dist/css', file: 'bootstrap.min.css')}" type="text/css">
        <link rel="stylesheet" href="${resource(dir: 'dist/css', file: 'offcanvas.css')}" type="text/css">

        <g:layoutHead/>
        <r:layoutResources />
    </head>

</html>

And I want to include this in all the gsp pages in my view. For that in View->User->list.gsp, I added the following tag in the head

<head>
        <meta name="layout" content="main">
        </head>

When i cal the list.gsp page what I am getting is a blank page. Where I went wrong?

Was it helpful?

Solution

You have created a layout without a body, so you will need to add to your layout

<body>
     <g:layoutBody/>
</body>

In other case, nothing will be printed

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top