I have a search page with a "search button", after hit that button I call a servlet. The servlet does some database operation and then puts the search result into a session variable. At the same time to hit the search button, another "search result" page pop-up. The result page should read the session variable, and then display the result.
My problem is: sometimes, the server runs so fast, when I try to read the session variable in result page, it is still null or I just get the old session value.
This problem really drives me crazy. Could some one give a good solution to solve this.
Hi, What you can probably do is, After processing the data in the servlet, initiate (i.e. popup) the result.jsp from the servlet.
One way of doing this is... forward the request to intermediate.jsp and in that jsp file say window.open with the necessary parameters. In this way your result.jsp will be called only after the servlet processing is complete.
Originally posted by Bear Bibeault: That's called a 'race condition' and it's been created at your own choosing. Change things so that the results page doesn't display until after the results have been obtained.
I think this would be the best way to do.
You can probably not make a call to that Results pop-up page until the session variable has been populated with the latest results.
Vijayendra <br /> <br />"The harder you train in peace, the lesser you bleed in war"