tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Beech <a.be...@bigpond.net.au>
Subject RE: JSP seems to be executing twice and we are getting duplicate records in our database
Date Mon, 04 Aug 2003 12:15:35 GMT
Hi Bill,

Would I be right in assuming that you're inferring  a user is submitting the
form multiple times by clicking the submit button/link more than once?  Or
are you perhaps suggesting the browser is sending multiple requests without
user intervention to the server hence the reason why the responding JSP is
processing duplicate requests to insert the data twice?

I understand your suggestions and points.  I don't however understand why
the problem is occuring as in our case the additional execution of the JSP
doesn't appear to be initiated by the user -- i.e. multiple clicks on a
submit button, etc.  I've triggered the submit using keyboard control which
should initiate only one instance of the form data being sent to the server
and the problem still occurs.

It also seems a bit kludgy to first determine if a session ID associated
with a specific record already exists prior to inserting a new row.

AB


-----Original Message-----
From: Bill Lunnon [mailto:bill@mirrim.com.au] 
Sent: Monday, 4 August 2003 9:27 PM
To: Tomcat Users List; a.beech@bigpond.net.au
Subject: RE: JSP seems to be executing twice and we are getting duplicate
records in our database


Adrian,

If you do not want anothe rows created every time the page is submitted,
then you are going to have to implement something to stop this. TOMCAT will
not do this for you.

Without knowing the requirements for the form, stopping multiple rows being
generated could be as simple as:
- Assign a session to the user (clients browser).
- When the form is submitted, capture the sessionId in the database with the
record.
- If there is no row with the sessionId in the database, create a new record
with an insert. If there is a existing session, use an update to modify the
record.


Hope this helps

Bill

-----Original Message-----
From: Adrian Beech [mailto:a.beech@bigpond.net.au]
Sent: Monday, 4 August 2003 8:45 PM
To: tomcat-user@jakarta.apache.org
Subject: JSP seems to be executing twice and we are getting duplicate
records in our database


Hi folks,

We have a weird problem where a JSP seems to be executing twice and we are
getting duplicate records in our database.  The data is coming from a HTML
form and upon submit a subsequent JSP page is called that performs the SQL
insert, etc.  We are also getting duplicate log messages so our initial
conclusion is that it's a Tomcat related issue.

We have tested this with Tomcat 3.3.1, J2SE 1.3.1 and from the client side
using both IE 5.5 and 6.0 and it happens intermittently.

At this stage we have absolutely no idea of what is going on.  Alas I didn't
write the code so I'm not up to speed with its structure, flow or
functionality.

I've searched the list archive and there appears to be several references to
similar problems.  However I am unable to find any real answer to what might
be causing this problem.

Hoping someone out yonder can help.

AB



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




Mime
View raw message