有关提交表单的问题.如果用不用BUTTON提交, 而用SUBMIT提交则正确提交.
<html>
<head>
<%@ page contentType="text/html;charset=Big5" %>
<%@ page import="java.sql.*"%>
<jsp:useBean id="db" scope="page" class="hello.condb" />
<jsp:useBean id="db1" scope="page" class="hello.catapage" />
<title>出車明細資料查詢</title>
</head>
<script>
function sub(){
document.forms[0].act.value="query";
document.forms[0].action="";
document.forms[0].submit();
return true;
}
</script>
<form method="post" action="cc.jsp" name="form1">
<table border="0" width="100%">
<tr>
<td width="20%">出車日期</td>
<td width="20%"><input type="text" name="dt" size="20"></td>
</tr>
<tr>
<td width="20%">收貨人</td>
<td width="20%"><input type="text" name="receive" size="20"></td>
</tr>
<tr>
<td width="100%" colspan="5">
<p align="center">
<input type="button" name="submit" value=" 查詢 " onclick="sub();">
<input type="hidden" name="act">
</td>
</tr>
</table>
<p align="center"> </p>
<% String receive4=request.getParameter("receive");
String sql3=null;
String btn=request.getParameter("act");
if (btn==null) btn="";
if ("query".equals(btn))
{
session.putValue("cc_l.sql",sql3);
}
String sq=null;
sq=(String)session.getValue("cc_l.sql");
if (sq==null) sq="";
String sql1="select count(*)";
sql1+=" from carry_m,carry_l where carry_m.dt=carry_l.dt and carry_m.lic_hk=carry_l.lic_hk";
sql1=sql1+sq;
ResultSet rs1=db.executeQuery(sql1);
rs1.next();
int rowCount=rs1.getInt(1); //查詢出符合條件的總行數.
out.print(rowCount);
%>
</form>
</body>
</html>
请指教.这是一个用到HIDDEN类型的问题.怎么样改正???