The way this is done is that whenever you build a form you generate a unique
token and also place this token in the clients session. Now whenever you
process the submission you remove the token from the session. For any
request you check to see if the token that came from a parameter from the
form is the same as the one in the session. If it isn't ie. there's no token
in the session then you've already serviced the submit in the past.

> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> Ricardo Camilo Lopez
> Sent: Friday, June 30, 2000 3:11 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [off-topic] prevent submit button hit twice?
>
>
> Well I think you are over doing it checking for duplicates values, since
> basically you are scanning the whole database.
>
> Wouldn't it be better caching/blocking the fisrt/second submit so
> that it s not
> even processed?
>
>
> "Shanmuga, KR" wrote:
>
> > u need to check from the server side (database) for
> > the duplicate values and popup a messg window to the
> > client abt that the record already exists ! if he hits
> > twice or more. (i think all the database applications
> > has the function to check for duplicate values.)
> >
> > unless if u want to do in the client side itself then
> > u need to do a lot like storing the values
> > temporarily, if the user hits submit check these
> > values with already stored values, if not matching
> > then u can pass those values to the server, otherwise
> > u can stop the user ....
> >
> > hope i've given atleast an idea.
> >
> > cheers
> > shan.
> >
> > --- Chin Cedric Sung Kit <[EMAIL PROTECTED]> wrote:
> > > hi,
> > >
> > > this is off-topic.  i would like to know is there
> > > anyway to prevent the
> > > user from hitting the submit button more than once?
> > > because if the user
> > > clicks twice or more, one or more duplicated data
> > > will be sent to the
> > > servlets; and duplicated data will be written into
> > > the database  as
> > > well....
> > >
> > > is there anyway to prevent this?
> > >
> > > thanks
> > >
> > > regards,
> > > ced
> > >
> > >
> >
> __________________________________________________________________
> _________
> > > 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
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Get Yahoo! Mail - Free email you can access from anywhere!
> > http://mail.yahoo.com/
> >
> >
> __________________________________________________________________
> _________
> > 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
>

___________________________________________________________________________
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