grails中报Cannot create a session after the response has been committed异常的解决办法
在grails中,我们在layouts\main.gsp中使用类似如下的代码来判断当前用户处于登录状态时显示相关的登录信息:
<g:if test="${session.users}">
...
</g:if>
<g:else>
...
</g:else>
但在运行时,发生了如下的异常:
Caused by GroovyPagesException: Error processing GroovyPageView: Cannot create a session after the response has been committed
->> 2886 | runWorker in \grails-app\views\layouts\main.gsp
要解决这个异常,可以使用如下方式来解决:
<g:if test="${request.getSession(false)?.users}">
...
</g:if>
<g:else>
...
</g:else>
也就是通过request对象来获取session时,不使用自动创建session的模式。
grails中报Cannot create a session after the response has been committed异常的解决办法的更多相关文章
- idea调试SpringMvc, 出现:”javax.servlet.ServletException: java.lang.IllegalStateException: Cannot create a session after the response has been committed"错误的解决方法
调试拦截器出现以下错误: HTTP Status 500 - javax.servlet.ServletException: java.lang.IllegalStateException: Cann ...
- Cannot create a session after the response has been committed
有时候在操作Session时,系统会抛出如下异常 java.lang.IllegalStateException: Cannot create a session after the response ...
- [Exceptions Spring 2] - Cannot create a session after the response has been committed
2016-02-23 14:06:27,416 [http-bio-8080-exec-1] DEBUG [org.springframework.beans.factory.support.Defa ...
- CAS-ERR Cannot create a session after the response has been committed
现象: 当cas 登录人数较少时候没有错误,但是用户过多时候出现下列err May-2016 18:09:11.932 SEVERE [http-nio-8080-exec-52] org.apach ...
- 关于springmvc重定向后Cannot create a session after the response has been committed问题
首先先上代码吧,我在用springmvc进行response.sendRedirect(url);操作后报了Cannot create a session after the response has ...
- C#做音乐播放器时在自动下一曲中报异常的解决办法
---------------------- ASP.Net+Unity开发..Net培训.期待与您交流! ---------------------- 在利用Media Player做音乐播放器的时 ...
- 关于子线程使用Toast报错Can't create handler inside thread that has not called Looper.prepare()的解决办法
形同如下代码,在Thread中调用Toast显示错误信息: new Thread(new Runnable(){ @Override public void run() { try{ weatherD ...
- OkHttp下载文件中途断网报Can't create handler inside thread that has not called Looper.prepare()异常的解决办法
最近做项目时出现个问题. 在一个基类中,创建一个Handler对象用于主线程向子线程发送数据,代码如下: this.mThirdHandler = new Handler(){ @Override p ...
- windows系统下的maven项目放到linux系统中运行时报org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnection这种异常的解决办法
这个错误的解决办法其实很简单你把连接mysql数据库的那个jar包换成linux版本的就行了: linux版本的连接mysql数据库的jar包链接:http://files.cnblogs.com/f ...
随机推荐
- Linux实施一次性任务
一.定义 at命令:定时任务,指定一个时间执行一个任务,只能执行一次. 二.选项 三.示例 1. 使用 student 用户,创建一个任务,2 分钟以后执行,在/home/student/at.txt ...
- Android端通过HttpURLConnection上传文件到服务器
Android端通过HttpURLConnection上传文件到服务器 一:实现原理 最近在做Android客户端的应用开发,涉及到要把图片上传到后台服务器中,自己选择了做Spring3 MVC HT ...
- BZOJ 1452 Count(二维树状数组)
题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=1452 题意:给出一个数字矩阵(矩阵中任何时候的数字均为[1,100]),两种操作:(1) ...
- BZOJ 2115 Xor(抑或值最大路径)
题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=2115 题意:给出一个带权无向图.求一条1到n的路径使得路径上权值的抑或值最大? 思路:( ...
- Perl date time
use Time::HiRes qw(time);use POSIX qw(strftime); my $t = time;my $date = strftime "%Y%m%d %H:%M ...
- GMT and CST
GMT(Greenwich Mean Time) 代表格林尼治标准时间 而CST却同时可以代表如下 4 个不同的时区: Central Standard Time (USA) UT-6:00 C ...
- plsql programming 16 动态SQL和动态PLSQL
动态SQL 是指在执行时才构建 SQL 语句, 相对于静态 sql 的编译时就已经构建. 动态PLSQL 是指整个PL/SQL代码块都是动态构建, 然后再编译执行的. 作用: 1. 可以支持 DDL ...
- 【Todo】MQ学习-RabbitMQ, ActiveMQ, Kafka等
之前学习过RabbitMQ,并且还安装过.安装记录的文章如下: Erlang:http://www.cnblogs.com/charlesblc/p/5512380.html RabbitMQ:htt ...
- delete-node-in-a-bst
https://leetcode.com/problems/delete-node-in-a-bst/ /** * Definition for a binary tree node. * struc ...
- UVa 1442 (线性扫描) Cave
对于一个水坑,水平面肯定是相等的.(废话,不然为什么叫水ping面) 因为水面不能碰到天花板,所以将水面向两边延伸要么碰到墙壁要么延伸到洞穴外面去. 设h(i)表示向左延伸不会碰到天花板的最高水平面, ...