Hi Kumaravadivelu,
What you can try is using the synchronized statement with your doPost().
Doing this will only allow one instance of your servlet at a time. Since
execution time is in mili-seconds, your users probably will not notice
however, doing so is not recommended in a high volume site. If you are
looking at a large volume (where large is relative) you probably need to
look at using a connection pool.
Tom Kochanowicz
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Kumaravadivelu
Sent: Tuesday, November 30, 1999 11:39 PM
To: [EMAIL PROTECTED]
Subject: Response while multiple hits
Hi,
I have a problem in getting response from the servlet when I call the
servlet simultaneously from different browsers/browser windows. The problem
is if I call the servlet from two browsers, one shows the response page
where as the second one show me an error 'document contains no data', can
anyone please let me know why am getting this error?
I am adding a piece of code here.
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
res.setContentType("text/html");
out=res.getOutputStream();
try {
<codes for database manipulation>
} catch (Exception e) {}
out.println("<html><head><title>Testing</title></head><body>");
out.println("<center>");
out.println("<h2>Your data has been accepted</h2>");
out.println("</center>");
out.println("</body></html>");
out.close();
}
Thanks in advance.
Kumaravadivelu
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html