?? do_search.jsp
字號(hào):
<%@ page language="java" contentType="text/html;charset=gb2312"%>
<jsp:useBean id="search" class="com.db.Common" scope="page"/>
<%@ page import="java.sql.*"%>
<html>
<head>
<title>搜索結(jié)果</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/mm_lodging1.css" type="text/css">
</head>
<%
request.setCharacterEncoding("gb2312");
if(session.getAttribute("isLogin")==null)
{
%>
<jsp:forward page="../login/login.html"/>
<%
}
String keywords=request.getParameter("keywords");
ResultSet rs=search.getResultSetBySql("select * from traininf where train_serial='"+keywords+"'");
%>
<body text=#003300 vLink=#002200 leftMargin=0 topMargin=0>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../image/16.gif"></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=600 align="center" bgcolor="#033D7C">
<TBODY>
<tr bgcolor="#a4c2c2">
<td height="36" colspan="3" id="navigation" class="navText" align="center"><a href="../user/index.jsp">首頁(yè)</a>
<a href="../user/inf_edit.jsp">控制面板</a> <a href="../common/exit.jsp">退出</a> </td>
</tr>
</TBODY>
</table>
<form name="search" method="post" action="../user/do_search.jsp">
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="700" bgcolor="#ebebeb"><span class="style2">搜索車(chē)次:</span>
關(guān)鍵字:<input type="text" name="keywords">
<input type="submit" value="Search">
</table>
</form>
<%
int stations_num=0;
int h_s_num=0;
int s_s_num=0;
int h_r_num=0;
int s_r_num=0;
if(rs.next())
{
%>
<table cellSpacing=0 cellPadding=0 width=600 align="center" align="center">
<tr>
<td width="600" align="center" bgcolor="#cccccc">
硬座票量
</td>
<td width="600" align="center" bgcolor="#cccccc">
軟座票量
</td>
<td width="600" align="center" bgcolor="#cccccc">
硬臥票量
</td>
<td width="600" align="center" bgcolor="#cccccc">
軟臥票量
</td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=600 align="center" align="center">
<%
//ResultSet rs=search.getResultSetBySql("select * from traininf where train_serial='"+keywords+"'");
%>
<tr>
<%
stations_num=rs.getInt(5);
h_s_num=rs.getInt(7);
s_s_num=rs.getInt(8);
h_r_num=rs.getInt(9);
s_r_num=rs.getInt(10);
%>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=h_s_num%>
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=s_s_num%>
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=h_r_num%>
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=s_r_num%>
</td>
</tr>
<%
%>
</table>
<%
ResultSet rs_stations=search.getResultSetByTable(""+keywords+"_stations_inf");
ResultSet rs_start_time=search.getResultSetByTable(""+keywords+"_start_time");
ResultSet rs_to_time=search.getResultSetByTable(""+keywords+"_to_time");
ResultSet rs_hs_price=search.getResultSetByTable(""+keywords+"_hard_seat_price");
ResultSet rs_ss_price=search.getResultSetByTable(""+keywords+"_soft_seat_price");
ResultSet rs_hr_price=search.getResultSetByTable(""+keywords+"_hard_recumbency_price");
ResultSet rs_sr_price=search.getResultSetByTable(""+keywords+"_soft_recumbency_price");
String[] stations=new String[stations_num];
String[] start_time=new String[stations_num-1];
String[] to_time=new String[stations_num-1];
float[] hs_price=new float[stations_num-1];
float[] ss_price=new float[stations_num-1];
float[] hr_price=new float[stations_num-1];
float[] sr_price=new float[stations_num-1];
if(rs_stations!=null&&rs_stations.next())
{
for(int i=1;i<=stations_num;i++)
{
stations[i-1]=rs_stations.getString(i+1);
}
}
if(rs_start_time!=null&&rs_start_time.next())
{
for(int i=1;i<stations_num;i++)
{
start_time[i-1]=rs_start_time.getString(i+1);
}
}
if(rs_to_time!=null&&rs_to_time.next())
{
for(int i=1;i<stations_num;i++)
{
to_time[i-1]=rs_to_time.getString(i+1);
}
}
if(rs_hs_price!=null&&rs_hs_price.next())
{
for(int i=1;i<stations_num;i++)
{
hs_price[i-1]=rs_hs_price.getFloat(i+1);
}
}
if(rs_ss_price!=null&&rs_ss_price.next())
{
for(int i=1;i<stations_num;i++)
{
ss_price[i-1]=rs_ss_price.getFloat(i+1);
}
}
if(rs_hr_price!=null&&rs_hr_price.next())
{
for(int i=1;i<stations_num;i++)
{
hr_price[i-1]=rs_hr_price.getFloat(i+1);
}
}
if(rs_sr_price!=null&&rs_sr_price.next())
{
for(int i=1;i<stations_num;i++)
{
sr_price[i-1]=rs_sr_price.getFloat(i+1);
}
}
%>
<br>
<table cellSpacing=0 cellPadding=0 width=600 align="center" align="center">
<tr>
<td width="600" align="center" bgcolor="#cccccc">
站點(diǎn)
</td>
<td width="600" align="center" bgcolor="#cccccc">
發(fā)車(chē)時(shí)間
</td>
<td width="600" align="center" bgcolor="#cccccc">
到達(dá)時(shí)間
</td>
</tr>
<tr>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
</tr>
<tr>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=stations[0]%>
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=start_time[0]%>
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
---
</td>
</tr>
<tr>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
</tr>
<%
for(int i=1;i<=stations_num-2;i++)
{
%>
<tr>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=stations[i]%>
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=start_time[i]%>
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=to_time[i-1]%>
</td>
</tr>
<tr>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
</tr>
<%
}
%>
<tr>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=stations[stations_num-1]%>
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
---
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=to_time[stations_num-2]%>
</td>
</tr>
</table>
<br>
<table cellSpacing=0 cellPadding=0 width=600 align="center" align="center">
<tr>
<td width="600" align="center" bgcolor="#cccccc">
相鄰站點(diǎn)
</td>
<td width="600" align="center" bgcolor="#cccccc">
硬座價(jià)格
</td>
<td width="600" align="center" bgcolor="#cccccc">
軟座價(jià)格
</td>
<td width="600" align="center" bgcolor="#cccccc">
硬臥價(jià)格
</td>
<td width="600" align="center" bgcolor="#cccccc">
軟臥價(jià)格
</td>
</tr>
<%
for(int i=1;i<stations_num;i++)
{
%>
<tr>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=stations[i-1]%>--<%=stations[i]%>
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=hs_price[i-1]%>
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=ss_price[i-1]%>
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=hr_price[i-1]%>
</td>
<td width="600" align="center" bgcolor="#EBEBEB">
<%=sr_price[i-1]%>
</td>
</tr>
<tr>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
<td width="600" align="center" bgcolor="#cccccc" height="3">
</td>
</tr>
<%
}
%>
</table>
<table cellSpacing=0 cellPadding=0 width=600 align="center" align="center">
<tr>
<td width="600" align="center" bgcolor="#EBEBEB">
<a href="../ticket/order.jsp?train_serial=<%=keywords%>">訂購(gòu)</a>
</td>
</tr>
</table>
<%
}
else
{
%>
<table cellSpacing=0 cellPadding=0 width=600 align="center" align="center">
<tr>
<td width="600" align="center" bgcolor="#cccccc">
對(duì)不起,沒(méi)有您要找的信息!
</td>
</tr>
</table>
<%
}
%>
</body>
</html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -