Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
脚手架页面的Grails错误响应编码_Grails_Scaffolding_Grails 2.3 - Fatal编程技术网

脚手架页面的Grails错误响应编码

脚手架页面的Grails错误响应编码,grails,scaffolding,grails-2.3,Grails,Scaffolding,Grails 2.3,在grails从2.2.3升级到2.3.6之后,我得到了脚手架页面的错误编码 对于普通页面,一切正常: Content-Type:text/html;charset=UTF-8 使用了相同的布局模板,但用于脚手架页面: Content-Type:text/html;charset=ISO-8859-1 Config.groovy: grails.views.default.codec = "html" // none, html, base64 grails.converters.enco

在grails从2.2.3升级到2.3.6之后,我得到了脚手架页面的错误编码 对于普通页面,一切正常:

Content-Type:text/html;charset=UTF-8
使用了相同的布局模板,但用于脚手架页面:

 Content-Type:text/html;charset=ISO-8859-1
Config.groovy:

grails.views.default.codec = "html" // none, html, base64
grails.converters.encoding = "UTF-8"

grails {
  views {
    gsp {
      encoding = 'UTF-8'
      htmlcodec = 'xml' // use xml escaping instead of HTML4 escaping
      codecs {
        expression = 'html' // escapes values inside ${}
        scriptlet = 'html' // escapes output from scriptlets in GSPs
        taglib = 'none' // escapes output from taglibs
        staticparts = 'none' // escapes output from static template parts
      }
    }
  }
}
布局:

<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

在新的测试应用程序中,所有组件都正常工作


在哪里可以找到响应编码设置

通过替换Config.groovy(来自Grails1.3和2.3)中的旧配置,该错误已得到修复

通过Grails2.3中的defoult配置

grails.mime.types = [ // the first one is the default format
                      all:           '*/*', // 'all' maps to '*' or the first available format in withFormat
                      atom:          'application/atom+xml',
                      css:           'text/css',
                      csv:           'text/csv',
                      form:          'application/x-www-form-urlencoded',
                      html:          ['text/html','application/xhtml+xml'],
                      js:            'text/javascript',
                      json:          ['application/json', 'text/json'],
                      multipartForm: 'multipart/form-data',
                      rss:           'application/rss+xml',
                      text:          'text/plain',
                      hal:           ['application/hal+json','application/hal+xml'],
                      xml:           ['text/xml', 'application/xml']
]

您是否在
BuildConfig.groovy
中添加了最新的脚手架插件,例如
compile:scaffolding:2.0.2“
?您是否事先在安装中运行了
install templates
,因此出现了错误的模板?是的,编译:添加了“:scaffolding:2.0.2”。嗯,我有web.xml的模板。我检查nowled web.xml是否不影响调试器中的编码I sow,该请求是否由Rest插件处理。因此,我们有错误的编码。
grails.mime.types = [ // the first one is the default format
                      all:           '*/*', // 'all' maps to '*' or the first available format in withFormat
                      atom:          'application/atom+xml',
                      css:           'text/css',
                      csv:           'text/csv',
                      form:          'application/x-www-form-urlencoded',
                      html:          ['text/html','application/xhtml+xml'],
                      js:            'text/javascript',
                      json:          ['application/json', 'text/json'],
                      multipartForm: 'multipart/form-data',
                      rss:           'application/rss+xml',
                      text:          'text/plain',
                      hal:           ['application/hal+json','application/hal+xml'],
                      xml:           ['text/xml', 'application/xml']
]