The only ways I know is to do this: - implement this on your own store some information in the page that enables you to decide whether the request has been resubmittet and act acordingly. - use a framework that does this for you. (AFAIK struts does this) - Remove the toolbar with the back button with javascript. (That way will not work for all cases, as some browser have a back button in a context menu that can't be diabled with javascript, and more important some users disable javascript)
> -----Ursprungliche Nachricht----- > Von: C Cayetano [mailto:[EMAIL PROTECTED]] > Gesendet: Donnerstag, 7. Februar 2002 09:58 > An: Tomcat Users List > Betreff: how to prevent hitting back button and re-executing code? > > > All, > > Problem: > I've got a name.jsp page which has a form to get lastname, firstname, > address, etc. > On submit the form is sent to a servlet for adding into the database > (primary key field is an incremental record ID) > Once processed the servlet redirects to a confirmation.jsp page > Now if the the user hits the back button, which pops a > 'retry' dialog box, > and the user hits retry button, the whole add process is > executed again and > the same lastname, firstname, address, etc. is entered into > the database, > basically creating duplicate records. > > Is there a way to prevent this? > > Thanks > > > -- > To unsubscribe: <mailto:[EMAIL PROTECTED]> > For additional commands: <mailto:[EMAIL PROTECTED]> > Troubles with the list: <mailto:[EMAIL PROTECTED]> > > > -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>
