📄 resultadvance2.jsp
字号:
if(flag==1)
{ all_station[countallstation]=station2;
countallstation++;
}//endif
} //endwhile
} //endwhile
// out.println(countallstation);
//把起始站包含关键字和终止站包含关键字的数据分别放入matchs[counts] and matche[counte]
for(int a=0;a<countallstation;a++)
{ if(all_station[a].indexOf(S_Station)!=-1)
{ matchs[counts]=all_station[a];
counts++;
//out.println(all_station[a]);
}//endif
if(all_station[a].indexOf(E_Station)!=-1)
{ matche[counte]=all_station[a];
counte++;
}//endif
}//endfor
result.close();
//查询所有包含有起始站,而不包含终点站的车次信息
sql2=con.createStatement();
String condition2="select * from bus where Detail LIKE '%"+S_Station+"%' AND Detail NOT LIKE '%"+E_Station+"+'";
result2=sql2.executeQuery(condition2);
while(result2.next())
{
S_BusID[j]=result2.getString("BusID");
S_Detail[j]=result2.getString("Detail");
j++;
}
result2.close();//关闭第二个结果集
//查询所有包含有终点站,不包含起始站的车次信息
sql3=con.createStatement();
String condition3="select * from bus where Detail LIKE '%"+E_Station+"%' AND Detail NOT LIKE '%"+S_Station+"+'";
result3=sql3.executeQuery(condition3);
while(result3.next())
{
E_BusID[h]=result3.getString("BusID");
E_Detail[h]=result3.getString("Detail");
h++;
}
result3.close();//关系第三个结果集
//把要转车的信息放Result2系列的数组
for(k=0;k<j;k++)
{ //初始临时变量,对S_Detail[]中的每一个元素进行比较
detail1=S_Detail[k];
//把detail1用'->'符号区分
StringTokenizer str1=new StringTokenizer(detail1,"->");
//对S_Detail[]中的每一个元素的每一个站点进行比较
while(str1.hasMoreTokens())
{
station1 = str1.nextToken();//初始临时变量
//取出E_Detail[]数组中的每一个元素
for(n=0;n<h;n++)
{ detail2=E_Detail[n];//定义临时变量
StringTokenizer str2=new StringTokenizer(detail2,"->");
//取出E_Detail[]数组中的每一个元素的每一个站点
while(str2.hasMoreTokens())
{ station2 = str2.nextToken();
//把结果存储到结果集中
if(station1.equals(station2))
{
Result2_ID1[count]= S_BusID[k];
Result2_tan[count]= station1;
Result2_ID2[count]= E_BusID[n];
count++;
} //endif
}//endwhile
}//endfor
}//endwhile
}//endfor
//输出转乘车次1,转乘车次2,以及中转站信息
if(count>0)
{
%>
<table width="650" border="0" bgcolor="#003399" cellpadding="3" cellspacing="1" align="center">
<tr>
<td height="20" background="Picture/topbg.gif"></td>
</tr>
<tr bgcolor="#7DA4EC">
<td><strong><font color="#FFFFFF">站点查询结果</font></strong></td>
</tr>
<tr bgcolor="#E8F3FF">
<td>
<!--查询结果显示开始-->
<strong></strong> <font color="FF0000"><%=S_Station%></font>到 <font color="FF0000"><%=E_Station%></font>没有直达车!请参照下列换乘建议.<br>
<table width="600" border="0" bgcolor="#003399" cellpadding="3" cellspacing="1"><tr bgcolor="#FDDD90"><td width="150"><strong>起点</strong></td><td width="70"><strong>车次</strong></td><td width="160"><strong>中转站</strong></td><td width="70"><strong>车次</strong></td><td width="150"><strong>终点</strong></td></tr>
<% //循环输出结果集
for(int marks=0;marks<counts;marks++)
for(int marke=0;marke<counte;marke++)
{ //查询所有包含有起始站,而不包含终点站的车次信息
count=0;
h=0;
j=0;
sql2=con.createStatement();
conditions[marks][marke]="select * from bus where Detail LIKE '%"+matchs[marks]+"%' AND Detail NOT LIKE '%"+matche[marke]+"+'";
result2=sql2.executeQuery(conditions[marks][marke]);
while(result2.next())
{
S_BusID[j]=result2.getString("BusID");
S_Detail[j]=result2.getString("Detail");
j++;
}
result2.close();//关闭第二个结果集
//查询所有包含有终点站,不包含起始站的车次信息
sql3=con.createStatement();
conditione[marks][marke]="select * from bus where Detail LIKE '%"+matche[marke]+"%' AND Detail NOT LIKE '%"+matchs[marks]+"+'";
result3=sql3.executeQuery(conditione[marks][marke]);
while(result3.next())
{
E_BusID[h]=result3.getString("BusID");
E_Detail[h]=result3.getString("Detail");
h++;
}
result3.close();//关系第三个结果集
//把要转车的信息放Result2系列的数组
for(k=0;k<j;k++)
{ //初始临时变量,对S_Detail[]中的每一个元素进行比较
detail1=S_Detail[k];
//把detail1用'->'符号区分
StringTokenizer str1=new StringTokenizer(detail1,"->");
//对S_Detail[]中的每一个元素的每一个站点进行比较
while(str1.hasMoreTokens())
{
station1 = str1.nextToken();//初始临时变量
//取出E_Detail[]数组中的每一个元素
for(n=0;n<h;n++)
{ detail2=E_Detail[n];//定义临时变量
StringTokenizer str2=new StringTokenizer(detail2,"->");
//取出E_Detail[]数组中的每一个元素的每一个站点
while(str2.hasMoreTokens())
{ station2 = str2.nextToken();
//把结果存储到结果集中
if(station1.equals(station2))
{
Result2_ID1[count]= S_BusID[k];
Result2_tan[count]= station1;
Result2_ID2[count]= E_BusID[n];
count++;
} //endif
}//endwhile
}//endfor
}//endwhile
}//endfor
//输出转乘车次1,转乘车次2,以及中转站信息
for(k=0;k<count;k++)
{ %>
<tr bgcolor="#E8F3FF" onMouseOver = "this.style.backgroundColor = '#FFF9EE'" onMouseOut = "this.style.backgroundColor = ''"><td width="150"><a href="resultquery2.jsp?query2=<%=matchs[marks]%>" target="_blank"><%=matchs[marks]%></a></td>
<td width="70"><a href="resultquery1.jsp?query1=<%=Result2_ID1[k]%>" target="_blank"><%=Result2_ID1[k]%></a></td><td width="160"> ==><a href="resultquery2.jsp?query2=<%=Result2_tan[k]%> " target="_blank"><%=Result2_tan[k]%> </a> ==> </td>
<td width="70"><a href="resultquery1.jsp?query1=<%=Result2_ID2[k]%>" target="_blank"><%=Result2_ID2[k]%></a></td><td width="150"><a href="resultquery2.jsp?query2=<%=matche[marke]%>" target="_blank"><%=matche[marke]%></a></td>
</tr> <% }
} //endfor %>
</table>
<!--查询结果显示结束-->
<br><img src="Picture/close_window.gif" width="78" height="21" border="0" style="CURSOR: hand;" onClick="window.close()"> </td>
</tr>
<tr>
<td height="20" background="Picture/bottombg.gif"></td>
</tr>
</table>
<% } else
//假如即没有直达车,转车两次也无法到达,输出以下信息
{ %>
<table width="650" border="0" bgcolor="#003399" cellpadding="3" cellspacing="1" align="center">
<tr>
<td height="20" background="Picture/topbg.gif"></td>
</tr>
<tr bgcolor="#7DA4EC">
<td><strong><font color="#FFFFFF">站点查询结果</font></strong></td>
</tr>
<tr bgcolor="#E8F3FF">
<td>
<!--查询结果显示开始-->
<font color="FF0000"><%=S_Station%></font>到 <strong></strong> <font color="FF0000"><%=E_Station%></font>没有直达车!请参照下列换乘建议.<br>
<br> 抱歉,<strong></strong><font color="FF0000"><%=S_Station%></font>到<strong></strong><font color="FF0000"><%=E_Station%></font>没有直达车,换乘一次也无法到达!
<!--查询结果显示结束-->
<br>
<img src="Picture/close_window.gif" width="78" height="21" border="0" style="CURSOR: hand;" onClick="window.close()"> </td>
</tr>
<tr>
<td height="20" background="Picture/bottombg.gif"></td>
</tr>
</table>
<p> </p>
<% }
} //endelse
} //endtry
catch(Exception e){
e.printStackTrace();
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -