This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I am new to jsp/servlet and feel confused about the javabean used among JSPs and Servlets. I have a web app, I do following things:
1. StatusBean statusBean = new StatusBean(); // this is a local variable
4. session.setAttribute("statusBean", statusBean);
And then, I will pass this session to few JSPs and servlets, and some fields in the statusBean might be changed in the following jsp/servlet, and finally, I finished some works and get result from this statusBean.
To me, when different clients visit the servlet, they got different sessions. So because of different sessions to different clients, the web container guarantees the statusBean is always different to different client. Am I right on this? If this is ture, I do not need worry too much. However, when I test my app, in some situation, client A's session shows client B's statusBean data. (I found this problem but it is not reproduced on every test) So, what should I do to gurantee client A always doing his job with his own statusBean, and client B doing with his too?
Thank you very much. I do not have any instance variables in my servlet and these 2 days, I tried to reproduce the problem so that I can narrow down the problem and post relevant code here. But it is really difficult to reproduce it and seems it only happens when there are many users. As my boss suggested, if not occurs freqently, we can ignore. Not a good boss, right?