Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IE submit duplicated request (randomly) and Weblogic throws "Connection reset by peer..." exception

 
Ping Li
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear JavaRancher:

I have a login jsp page that logs user’s login history in the database, I just found out that there is duplicated logging information inserted in the database with a single login action. It happens randomly when using IE (version 6).

Every time when a double logging happens, it is always associated a server (weblogic 6) side exception: "javax.servlet.jsp.JspException: Connection reset by peer: socket write error". I debugged into the service (strut action source code) and found that the same request has been submitted to the service twice. It seems that IE browser abruptly drops the existing connection to the server and immediately requests the same page again (in this case, IE send duplicated login request to the server).

The duplicated request issue does not happen when using Firefox.

I don’t know how to fix the problem , your help is highly appreciated.

By the way I am using struts1.1:

The jsp form used is something similar like this:

<html:form action="/login/login.do" focus="accountNumber" >
<html:text property="accountNumber" maxlength="50" title="accountNumber"/>
...

<INPUT TYPE=image SRC="BtnLogin.gif" onClick="return verifyTerms(); " onMouseOver="this.src='BtnLogin_mo.gif'" onMouseOut="this.src='BtnLogin.gif'" />
</html:form>
 
Ping Li
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Additional information, the javascript function the form used is:

<SCRIPT LANGUAGE="JavaScript1.1" >
function verifyTerms()
{
if ( ....)
{
alert("The terms and conditions\nmust be accepted to login.");
return false;
}
document.forms[0].submit();
return true;
}
</SCRIPT>
 
Ping Li
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Issue solved.

Based on my research and online information, it’s mostly like an IE bug. IE browser abruptly drops the existing connection to the server and immediately requests the same page again. In my jsp file, submit action is emitted from JavaScript function, this implementation somehow triggers IE bug. So I removed submit() call from javascript function, instead, submit() is called from submit button's onClick="....; submit();...", after that, the duplicated submission problem disappeared.

Here is code after modification:

<INPUT TYPE=image SRC="...BtnLogin.gif" onClick="return verifyTerms(); submit(); this.disabled=’true’; " onMouseOver="this.src='...BtnLogin_mo.gif'" onMouseOut="this.src='...BtnLogin.gif'" />

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic