2014-04-02 43 views
0

我在佈局文件夾中創建了一個gsp頁面。代碼如下: - layout-> main.gsp包括grails中所有視圖頁面的公共佈局

<!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> 

我想在我的視圖中包含所有gsp頁面。對於在查看 - >用戶 - >的list.gsp,我添加了以下標籤的頭部

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

當我CAL我所得到的是一個空白頁的list.gsp頁面。我哪裏出錯了?

+0

好嗎?有什麼問題?什麼不工作? –

+0

當我打開列表頁面我得到的是一個空白頁面 – Sag

+0

@JoshuaMoore我編輯了我的問題 – Sag

回答

3

您已經創建了一個佈局沒有身體,所以你需要添加到您的佈局

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

在其他情況下,什麼都不會被打印

+0

它確實工作.. – Sag