Home GRAILS : <g:layoutTitle> does not work
Reply: 0

GRAILS : <g:layoutTitle> does not work

user1737
1#
user1737 Published in May 25, 2018, 6:51 pm

I want to create layout for my grails application based on this tutorial: http://grails.asia/grails-tutorial-for-beginners-layout-templates

I create a page.gsp with the skeleton of my page:

<!DOCTYPE html>
<html>
<head>
    <title><g:layoutTitle default="Grails"/></title>
    <style>
    #header {background-color:#ffe0e0;text-align: center;}
    #footer {background-color:#e0e0ff;text-align: center;}
    </style>
    <g:layoutHead/>
</head>
<body>
    <div id="header">HEADER</div>

    <g:layoutBody/>
    <div id="footer">FOOTER</div>
</body>
</html>

And mainpage.gsp with main content:

    <!DOCTYPE html>
    <html>
    <head>
        <meta name="layout" content="page"/>
        <title>I am a test page</title>
        <link rel="stylesheet" href="${resource(dir: 'css', file: 'main.css')}" type="text/css">
    </head>
    <body>
    <p>Test page.</p>
    </body>
    </html>

Page is mapped in UrlMappings.groovy:

"/"(view:'/layouts/page')

But when I try to run my project I always got the error message like this:

URI/ Class java.lang.NullPointerException Message Request processing failed; nested exception is org.grails.gsp.GroovyPagesException: Error processing GroovyPageView: [views/layouts/page.gsp:4] Error executing tag : [views/layouts/page.gsp:4] Error executing tag : null Caused by null

Without it works properly. How can I solve this problem?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.300241 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO