静态页面:
</head>
<body>
<form action="ShowAirline.jsp" method="get">
出发城市<input type="text" name=Departure/><br>
目的城市<input type="text" name=Destination/><br>
出发日期<input type="text" name=Date/><br>
<input type="button" name=submit value=查询 />
</form>
</body>
</html>JSP页面:
<%@page language="java" contentType="text/html charset=utf-8" pageEncoding="utf-8"%>
<%@page import="java.util.LinkedList"%>
<%@page import="Service.ShowAirline"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查询结果<title>
</head>
<body>
<%
String Departure = request.getParameter("Departure");
String Destination = request.getParameter("Destination");
String departureDate = request.getParameter("Date");
if(Departure == null){
Departure = "";
}
if(Destination == null){
Destination = "";
}
if(departureDate == null){
departureDate = "";
}
ShowAirline show = new ShowAirline();
LinkedList Airline_info = show.Search();
int i = 0;
int sum = Airline_info.size();
String info[] = new String[sum];
while(i < sum){
info[i] = (String)Airline_info.get(i);
i++;
}
for(i = 0; i < sum; i++){
String each_info[] = info[i].split("|");
%>
<table border="" align="center">
<tr>
<td>航班</td><td>出发地</td><td>目的地</td><td>出发日期</td><td>票数</td><td>价格</td>
</tr>
<br>
<%
if(each_info[1]==Departure && each_info[2]==Destination && each_info[3]==departureDate){
%>
<tr>
<td><%=each_info[0]%></td>
<td><%=each_info[1]%></td>
<td><%=each_info[2]%></td>
<td><%=each_info[3]%></td>
<td><%=each_info[4]%></td>
<td><%=each_info[5]%></td>
</tr>
<br>
</table>
<%
}
}
%>
<form action="Serice.purchase" method="get">
请输入航班号<input type="text" name=id/><br>
请输入购买票数<input type="text" name=number/><br>
<input type="button" name=submit/>
</form>
</body>
</html>
</head>
<body>
<form action="ShowAirline.jsp" method="get">
出发城市<input type="text" name=Departure/><br>
目的城市<input type="text" name=Destination/><br>
出发日期<input type="text" name=Date/><br>
<input type="button" name=submit value=查询 />
</form>
</body>
</html>JSP页面:
<%@page language="java" contentType="text/html charset=utf-8" pageEncoding="utf-8"%>
<%@page import="java.util.LinkedList"%>
<%@page import="Service.ShowAirline"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查询结果<title>
</head>
<body>
<%
String Departure = request.getParameter("Departure");
String Destination = request.getParameter("Destination");
String departureDate = request.getParameter("Date");
if(Departure == null){
Departure = "";
}
if(Destination == null){
Destination = "";
}
if(departureDate == null){
departureDate = "";
}
ShowAirline show = new ShowAirline();
LinkedList Airline_info = show.Search();
int i = 0;
int sum = Airline_info.size();
String info[] = new String[sum];
while(i < sum){
info[i] = (String)Airline_info.get(i);
i++;
}
for(i = 0; i < sum; i++){
String each_info[] = info[i].split("|");
%>
<table border="" align="center">
<tr>
<td>航班</td><td>出发地</td><td>目的地</td><td>出发日期</td><td>票数</td><td>价格</td>
</tr>
<br>
<%
if(each_info[1]==Departure && each_info[2]==Destination && each_info[3]==departureDate){
%>
<tr>
<td><%=each_info[0]%></td>
<td><%=each_info[1]%></td>
<td><%=each_info[2]%></td>
<td><%=each_info[3]%></td>
<td><%=each_info[4]%></td>
<td><%=each_info[5]%></td>
</tr>
<br>
</table>
<%
}
}
%>
<form action="Serice.purchase" method="get">
请输入航班号<input type="text" name=id/><br>
请输入购买票数<input type="text" name=number/><br>
<input type="button" name=submit/>
</form>
</body>
</html>
解决方案 »
- <html:text>property的问题
- 如何关闭springmvc中的控制台Debug和INFO信息
- 急求教:WEB省市两级数据库分布式访问的具体思路
- JS监听键盘事件初始化的问题
- 200分,哪位高人有用JFreeChart 画出柱状图后,手动控制其bar宽度的经验?
- JSP程序访问ORACLE数据库是不是还要进行一些配置啊?
- 我想在jsp里操作网站目录下的文件和文件夹该怎么做?
- 多重选择执行的问题,求思路
- 两个网页间值传递的问题~~~~
- 请问为什麽在J2ee中客户端(测试时)用jndi定位enterprise bean的时候,可以把远程接口实例化?接口不是不可以生成对象的吗?
- 求解,如何在JSP页面显示word文档
- JSTL中的EL
<input type="button" name=submit value=查询 />
只是一个按钮,而要提交表单就要使用type="submit"的按钮
不过如果用button你可以通过JS提交,呵呵!
对于get方式,服务器端用Request.QueryString获取变量的值
建议改为post方式提交
<form action="ShowAirline.jsp" method="get">这个地方的method="get"改成method="post"试试。
另外还有一个地方千万要注意,就是java的变量定义出发城市<input type="text" name=Departure/><br>
目的城市<input type="text" name=Destination/><br>
出发日期<input type="text" name=Date/><br>把“name=Departure”改成"name=departure",java中变量定义第一个英文单词的字符小写,跟这个可能有关系;
楼主改过来试试