JSP form getting submitted twice
843838May 31 2007 — edited May 31 2007Hi,
The html form is getting submitted twice...that is it invokes the servlet twice and I see the servlet getting executed twice...there is NO GET method calling POST or viceversa...any help is appreciated...I tried a lot of possible solutions but in vain...
thanks,
Sri
JSP Code:-------------->>>>>>>>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<script language="javascript">
function evalCall(object)
{
//alert("length is-->" + object.value.length);
var control= document.getElementById('testForm');
if(object.value.length==2)
{
control.action="SearchServlet";
control.method="post";
control.submit();
//return false;
}
else
{
return;
}
}
</script>
</head>
<BODY>
<form id="testForm">
<table>
<tr>
<td>Enter the city name
<input type="text" id="searchValue" name="searchValue" onkeyup="evalCall(this)">
</td>
</tr>
</table>
</form>
</BODY>
</HTML>