No, SingleThreadModel won't solve this problem. The web server/servlet engine
will still handle concurrent requests. The difference is that with
SingleThreadModel, each request will be sent to a different instance of the
servlet, rather than as a separate thread to the same instance.

How to solve this problem? Don't click the "submit" button more times at a very
fast speed. Seriously. Sure it's a problem if one of your user's does this, but
it's a problem they've created themselves by doing something they shouldn't have
done.

One approach I've seen is to use JavaScript in the web page to set a flag when
the submit button is clicked the first time. This flag is checked whenever
submit is clicked, and subsequent clicks are ignored if the flag was previously
set. This solution fails when the user clicks the stop button before a new page
is received or if the response comes back in a new window.

Kevin Mukhar

Venkat Nimishakavi wrote:
>
> Try running your servlet in SingleThreadModel
>
> > -----Original Message-----
> > From: Zou hua [SMTP:[EMAIL PROTECTED]]
> > Sent: Wednesday, December 08, 1999 3:19 AM
> > To:   [EMAIL PROTECTED]
> > Subject:      more threads write to the same result page
> >
> > Hello all,
> >
> > I have a servlet that uses Cookies. When I click the "submit" button from
> > the HTML page once, it works well. If I click this button more times at a
> > very fast speed, then the returned page looks very strange. It seems there
> > are more than one datastreams being writen in the same result page.
> >
> > I have checked my log file. it seems there is only one seesion associated
> > with these clicks, of course, this is what I expected.  But more than one
> > servlets ( or threads) runs for these click, maybe each click is
> > associated
> > with one .  Some of them can catch IOException and some of them catch
> > NULLPointerException when  they try to write to
> > "response.getOutputStream()".
> >
> > How to solve this problem?

___________________________________________________________________________
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

Reply via email to