0

我是 Grails 的新手。我在 3 天前开始学习 Grails。我想在我的示例 Grail 应用程序中使用 twitter 引导程序。我正在关注本教程

runtime ':twitter-bootstrap:2.3.2'在我的 grails-app/conf/BuildConfig 文件中添加了。

这是我要使用引导程序的 list.gsp 文件。

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
  <head>
    <title>My Posts</title>
    <r:require modules="bootstrap"/>
  </head>
  <body>
  <g:link controller="post" action="edit">
        Create a new post
  </g:link>
  <div class="well"> 
  <h1>My Posts</h1>

  <g:each in="${posts}" var="post">
    <div>
      <h2>${post.title}</h2>
      <p>${post.teaser}</p>
      <p>Last Updated: ${post.lastUpdated}</p>
      <g:link controller="post" action="edit" id="${post.id}">
            Edit this post
      </g:link>
      <g:link controller="post" action="view" id="${post.id}">
         View this post
      </g:link>
  </div>
  </g:each>
 </div>
 </body>
 </html>

这是我的插件列表

plugins {
    runtime ":hibernate:$grailsVersion"
    runtime ":jquery:1.8.3"
    runtime ":resources:1.2"
    runtime ':twitter-bootstrap:2.3.2'

    // Uncomment these (or add new ones) to enable additional resources capabilities
    //runtime ":zipped-resources:1.0"
    //runtime ":cached-resources:1.0"
    //runtime ":yui-minify-resources:0.1.5"

    build ":tomcat:$grailsVersion"

    runtime ":database-migration:1.3.2"

    compile ':cache:1.0.1'
}

它不工作。我是 Grails 的新手。我不知道为什么它不起作用。请帮忙..

4

1 回答 1

3

添加到 list.gsp

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

并更改布局文件夹中的 main.gsp ,如本例所示

于 2013-07-05T07:44:42.963 回答