jsp如何实现表单提交的查询结果显示在当前页面?
<formmethod="post"action="telnum.do?method=query"><tdheight="33"colspan="3"align="lef...
<form method="post" action="telnum.do?method=query">
<td height="33" colspan="3" align="left" bgcolor="#EEEEEE">查询选项>>部门:
<select id="slt1" name="dept" onChange="">
<option selected value=""></option>
<% //这个是调用dao层返回市表中的内容。
TelBean elBean = new TelBean();
ResultSet rs = null;
//int i=0;
String sql = "select distinct dept from TelNum";
rs = elBean.query(sql);
System.out.println("经过数据库查询");
//ArrayList<String> list=new ArrayList();
while(rs.next()){
System.out.println(rs.getString("dept"));
String val = rs.getString("dept");
%>
<option value="<%=val%>"><%=val%></option>
<%
}
%>
</select>
</td>
<td align="center" colspan="2" bgcolor="#EEEEEE">姓名:<input type="text" name="name_"></td>
<td align="center" colspan="1" align="right" bgcolor="#EEEEEE"><input type="submit" name="Submit" value="查询"><input type="submit" name="Submit" value="重置"></td>
<td align="center" colspan="1" align="right" bgcolor="#EEEEEE"></td>
</form> 展开
<td height="33" colspan="3" align="left" bgcolor="#EEEEEE">查询选项>>部门:
<select id="slt1" name="dept" onChange="">
<option selected value=""></option>
<% //这个是调用dao层返回市表中的内容。
TelBean elBean = new TelBean();
ResultSet rs = null;
//int i=0;
String sql = "select distinct dept from TelNum";
rs = elBean.query(sql);
System.out.println("经过数据库查询");
//ArrayList<String> list=new ArrayList();
while(rs.next()){
System.out.println(rs.getString("dept"));
String val = rs.getString("dept");
%>
<option value="<%=val%>"><%=val%></option>
<%
}
%>
</select>
</td>
<td align="center" colspan="2" bgcolor="#EEEEEE">姓名:<input type="text" name="name_"></td>
<td align="center" colspan="1" align="right" bgcolor="#EEEEEE"><input type="submit" name="Submit" value="查询"><input type="submit" name="Submit" value="重置"></td>
<td align="center" colspan="1" align="right" bgcolor="#EEEEEE"></td>
</form> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询