-
1. Re: Need urgent help: how to avoid concurrent calls on state
jonlee May 11, 2003 7:49 AM (in response to tkitz)Can you set up a session flip-flop to stop double bounce? That is, toggle a servlet session variable to indicate that the form has been submitted and clear it when you complete the form submission? Check the variable before allowing submission. Is that sufficient for your needs?
-
2. Re: Need urgent help: how to avoid concurrent calls on state
tkitz May 14, 2003 3:04 PM (in response to tkitz)Hi,
thanks for your suggestion, which is partly working. I put the flip-flop routine on the top of the service method of the servlet and release the lock at the end of each JSP page. The routine at the top of the method is
// Servlet Toggle on
if ((session.getAttribute("cAHDServletToggle") != null) && (session.getAttribute("cAHDServletToggle").equals("t"))) {
// subsequent calls
return;
} else {
// first call
session.setAttribute("cAHDServletToggle","t");
}
The problem now is, when a user hits the submit button twice, the service method is called the second time, runs into the first part of the if-statement and returns. At that stage, the first request is suspended and no output is made through Tomcat, which is maybe better than an error message, but not what I had in mind :-)). Any ideas how to handle this problem?
Thanks,
Thorsten.