有时候在操作Session时,系统会抛出如下异常
java.lang.IllegalStateException: Cannot create a session after the response has been committed
之所以会出现此类问题是因为我们在Response输出响应后才创建Session的。
(因为那时候服务器已经将数据发送到客户端了,即:就无法发送Session ID 了)
解决办法:
你只需要在你的程序中将创建访问Session的语句【request.getSession()】提前至Response输出数据之前就好了。
Original: https://www.cnblogs.com/raphael5200/p/6554955.html
Author: Bodi
Title: Cannot create a session after the response has been committed
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/543123/
转载文章受原作者版权保护。转载请注明原作者出处!