<%@ page import="com.yulongtao.db.*"%>
<table border="0" width="50%" align="center">
<tr>
<th>预约单号:<input type="text" name="yydh"></th>
<th>客人编号:<input type="text" name="krbh"></th>
<th>单号状态:<input type="text" name="dhzt"></th>
<th>宝宝姓名:<input type="text" name="bbxm"></th>
<th>爸爸姓名:<input type="text" name="fqxm"> <button>确 定</button></th></tr>
</table>
<table border="1" width="50%" align="center">
<form action="Host.jsp" method="post"
<tr><th>预约单号</th><th>客人编号</th><th>单号状态</th><th>宝宝姓名</th><th>爸爸姓名</th></tr>
<%
DBFactory dbf=new DBFactory();
Query query=new Query("*","T_YYD","");
TableEx tableEx=dbf.query(query);
int iRecordCount=tableEx.getRecordCount();
Record record;
for(int i=0;i<iRecordCount;i++){
record=tableEx.getRecord(i);
%>
<tr>
<td><%=record.getFieldByName("SYYDH").value %></td>
<td><%=record.getFieldByName("SKRBH").value %></td>
<td><%=record.getFieldByName("SDHZT").value %></td>
<td><%=record.getFieldByName("STXBH").value %></td>
<td><%=record.getFieldByName("SYJPSSJ").value %></td>
</tr>
<%}
%>
</table>
我要的效果是点击确定之后,保存到数据库然后刷新显示在下面的表格中。 能在<form action="Host.jsp" method="post" 之后帮我写个示例的代码吗?
追答看来你不想用ajax了,操作步骤如下:
1、在当前页面增加一个隐藏的iframe标签
2、设置表单提交的目标位你的iframe
3、数据提交后,在iframe载入的页面里面写一句js代码:
window.parent.document.getElementById("listFrame").location.reload()
4、完毕。
总结,关键技术是使用DOM对象window的top、parent对象调用其他页面的js方法。
自己试一试吧。