This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / 请问一个关于JSP 与JAVABEAN中SESSION的问题
-ivy_sh(纸蝶);
2002-9-25
{1049}
(#766138@0)
-
change HttpSession timeout value
-handler(憨豆乐不起来了);
2002-9-25
(#766207@0)
-
如果改变TIMEOUT的值,也会影响到浏览时的时间.我是允许他们在看网页时有半小时不更新的(总要允许他们离开一会吧).但我希望是在HTTPSESSION关闭时我的数据库连接也即时失效.
-ivy_sh(纸蝶);
2002-9-25
(#766234@0)
-
What you did works when the user does log out(request.getSession(false).invalidate()).What you want is still a puzzle now as far as I know. The client can close the browser arbitrarily while the server knows nothing about it, simply waiting the seession times out. Javascript Unload does not work here unfortunately. Sorry to give you bad news.
-yuanzidan(原子弹);
2002-9-25
{259}
(#766226@0)
-
那看来我只能跟用户讲:"一定一定要正常退出啊!" too bad :(
-ivy_sh(纸蝶);
2002-9-25
(#766242@0)
-
Not 2 bad although beans do consume some memory. The only bad thing is for Admin.When Admin is happy seeing some peopel online and wants to talk/communicate with those guys, they may be in lunch or in shopping.
Mangage your resource carfully, don't keep a connection opening while doing nothing with it. Release it immidiatly after use it . Looks like your current design have some minor problems. Never trust clients, they always do something unexpected and keep trying to break down your application, hehe, same as me. good luck.
-yuanzidan(原子弹);
2002-9-25
{454}
(#766428@0)
-
Close the database connection after every page of JSP code you are executing. Don't keep one connection opened for the life span of one session. That's VERY expensive. Imagine if you have1000 active sessions at some given time........
-jeffrey815(Smartiecat);
2002-9-25
{47}
(#766258@0)
-
No, I can't disconnect database for per page. I have to trace their session,because every user has one order. 这是一个类似网上定货系统.
-ivy_sh(纸蝶);
2002-9-25
(#766538@0)
-
你可以在session里保存他们订了什么,在最后结帐的时候一起进行数据库操作的
-hugefox(长得象熊的狐狸);
2002-9-25
(#766588@0)
-
查查有关shopping cart的demo code,很多,基本上都是放在session里,等最后check out时才真正放到DB里。
-luoboyang(萝卜秧);
2002-9-25
(#766611@0)