【问题标题】:Page title in grails displayed on the bodygrails 中的页面标题显示在 body 上
【发布时间】:2012-11-20 16:20:09
【问题描述】:

当我尝试使用标题标签设置视图页面的标题时,我在页面正文上得到了这个标题,我发现头部标签为空。这是页面的标题:

<head>      
        <meta name="layout" content="main">
        <title>Implementation Error</title>
        <link rel="stylesheet" href="${resource(dir: 'css', file: 'errors.css')}" type="text/css">
         <r:require modules="bootstrap"/>
</head>

当页面被渲染时,我得到了以下信息:

<body>
    Implementation Error

            <script src="/accountcontrol/static/plugins/jquery-1.7.2/js/jquery/jquery-1.7.2.min.js" type="text/javascript"></script>
        <link href="/accountcontrol/static/bundle-fixtaglib_head.css" type="text/css" rel="stylesheet" media="screen, projection">
        <link href="/accountcontrol/static/bundle-bundle_bootstrap_head.css" type="text/css" rel="stylesheet" media="screen, projection">

            <link href="/accountcontrol/css/style.css" type="text/css" rel="stylesheet">


    <script type="text/javascript" src="/accountcontrol/static/js/lputil.js"></script>
</body>

这是怎么回事?

谢谢,

【问题讨论】:

  • 没有堆栈跟踪,没有异常,只是“实施错误”?
  • Implementation Error 是我在视图页面顶部设置的标题。这不是错误。

标签: grails layout


【解决方案1】:

我在使用 Grails 2.2 时遇到了同样的问题,它把我带到了这里。经过大量的牦牛剃须,我发现您需要查看您的 main.gsp 布局文件并将布局标题标签实际包装在标题标签中,如下所示:

 <title><g:layoutTitle/></title>

一旦我这样做了,问题就消失了。我一定已经看过 this 页面一百万次了,但没有看到。

【讨论】:

    【解决方案2】:

    检查您的“主要”布局并确保在 head 部分中定义了“g:layoutTitle”标签。欲了解更多信息,请参阅layoutTitle docs

    【讨论】:

      猜你喜欢
      • 2011-06-17
      • 1970-01-01
      • 2016-01-06
      • 1970-01-01
      • 1970-01-01
      • 2011-08-09
      • 2013-04-06
      • 2022-01-25
      • 1970-01-01
      相关资源
      最近更新 更多