简体   繁体   中英

I can't apply my layout to GSP page (grails)

I create a layout for my website using grails, but this layout is applied to my default page (the page where i redirect user after authentication) only

My layout :

    <title><g:layoutTitle default="An example decorator" /></title>
    <!-- css -->
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <link href="css/fancybox/jquery.fancybox.css" rel="stylesheet">
    <link href="css/jcarousel.css" rel="stylesheet" />
    <link href="css/flexslider.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet" />

    <!-- Theme skin -->
    <link href="skins/default.css" rel="stylesheet" />

    <g:layoutHead /> 

</head>
<body>
<div id="wrapper">
    <!-- start header -->
    <header>
        ...
    </header>
    <!-- end header -->
    <section id="content">
        <div class="container">
            <g:layoutBody/>
        </div>
    </section>
    <!-- footer-->
    <footer>
        <div class="container">
            <div id="footer">
                ...
            </div>  
        </div>
    </footer>
    <!-- /footer-->
</div>
</body>
</html>

i call this layout in my GSP page like this :

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

make sure you put your layout at:

grails-app/views/layouts/ 

and your layout name is:

application.gsp 

OR
if your layout is for a specific controller put at:

grails-app/views/layouts/controllerName/

still with same name:

application.gsp 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM