gpt4 book ai didi

session - 如果之前未访问 session ,则Grails 2.3.0无法访问 View 中的 session

转载 作者:行者123 更新时间:2023-12-02 14:24:50 26 4
gpt4 key购买 nike

java.lang.IllegalStateException: Cannot create a session after the response has been committed

Caused by: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: Error executing tag <g:isSelfProfile>: Cannot create a session after the response has been committed

升级到Grails 2.3.0 GA之后,当我尝试在 View 中访问 session变量(或只是调用 ${session == null})时,如果之前未在 Controller 中创建 session ,则会出现异常。

最佳答案

由于可以通过请求变量访问 session ,而无需创建新 session 。如果在此之前未创建 session ,则将返回null。

${request.getSession(false)}

也是资源插件的 Debug模式,即* grails.resources.debug = true *触发此操作...

关于session - 如果之前未访问 session ,则Grails 2.3.0无法访问 View 中的 session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19103255/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com