首页
/
每日頭條
/
知識
/
session異常什麼意思
session異常什麼意思
更新时间:2026-01-26 15:30:43

  session的開啟和關閉是在service層執行的,但是我們真正使用查詢的對象的數據時,是在web層,但是這個時候session已經關閉,就會報no-session異常。

  原因:就是session的關閉是在真正使用數據(這時候發送sql語句)之前。即web層使用對象的屬性的時候,session已經關閉

  解決辦法:讓session的關閉時間要在web層使用完之後。在web.xml中配置開啟和關閉session的過濾器即可,但是要配在struts的過濾器之前,否則無效

Comments
Welcome to tft每日頭條 comments! Please keep conversations courteous and on-topic. To fosterproductive and respectful conversations, you may see comments from our Community Managers.
Sign up to post
Sort by
Show More Comments
Copyright 2023-2026 - www.tftnews.com All Rights Reserved