📄 homepage.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<!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=gb2312" />
<title>南昌公交查询网</title>
<style type="text/css">
<!--
body {
background-image: url();
margin-left: 100px;
margin-right: 100px;
margin-top: 0px;
margin-bottom: 0px;
background-color: #999999;
}
.STYLE4 {font-size: 14px}
.STYLE7 {font-weight: bold}
.style8 {color: #FF0000}
.STYLE2 {font-weight: bold}
.style11 {font-size: smaller}
.style13 {font-size: small; font-weight: bold; }
.style6 {font-size: small}
a:link {
color: #000000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #FF0000;
}
a:active {
text-decoration: none;
color: #FF0000;
}
.style15 {
font-size: x-large;
font-weight: bold;
}
.style16 {color: #000000}
.style17 {font-size: 14px; color: #000000; }
-->
</style></head>
<body>
<%String busid[]=new String[100]; //存放车次查询一的车次号
int i=0;
String statement1="";
ResultSet result1;
Connection con; //声明一个连接
String statement2="";
ResultSet result2;
int count=0;
String all_station[]=new String[1000]; //用来存储所有站点信息
//存储临时变量
String temp="";
String detail="";
String station1="";
String station2="";
int flag=0,mark=0,flag1=0; //标识符,用来跟踪程序的执行.
Comparator cmp = Collator.getInstance(java.util.Locale.CHINA); //创建排序实例
//加载数据源
try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){}
try{
con=DriverManager.getConnection("jdbc:odbc:nbos","","");
//把车次查询的车次号存入busid[]中。
Statement sql1=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
statement1="select * from bus order by Sort ASC";
result1=sql1.executeQuery(statement1);
while(result1.next())
{ busid[i]=result1.getString("BusID");
i++;
}
result1.close();
//不重复地取出每一个站点,存入数组all_station[]中,并按首字拼间排序。
Statement sql2=con.createStatement();
statement2="select * from bus";
result2=sql2.executeQuery(statement2);
//取出数据库中第一行信息,初始数组all_station[]
if(result2.next())
{ detail=result2.getString("Detail");
StringTokenizer str=new StringTokenizer(detail,"->");
all_station[0]=str.nextToken();
count++;
while(str.hasMoreTokens())
{ temp=str.nextToken(); //temp用来存储临时变量
for(int countfirst=0,mark1=0;countfirst<count&&mark1==0;countfirst++)
{ if(all_station[countfirst].equals(temp))
{ mark1=1; //跟踪站点是否相同,若相同则结束循环
flag1=0;
}
else
flag1=1; //跟踪比较完所有DETAIL后,当前站点是否为新站点,其中1表示是新,0表示是已存在
}
if(flag1==1)
{ all_station[count]=temp;
count++;
}
}//endwhile
}//endif
//遍历数据库,把所有站点不重复地放入数组all_station[]数组中
while(result2.next())
{ //把每一条记录放入临时变量detail中
detail=result2.getString("Detail");
StringTokenizer str1=new StringTokenizer(detail,"->");
//对每一条记录的每一个站点进行比较
while(str1.hasMoreTokens())
{ mark=0;//恢复mark的值,以便比较下一条记录
StringTokenizer str2=new StringTokenizer(str1.nextToken()," ");
station2=str2.nextToken();
//注:count是随着程序的执行而不断的增加
for(int k=0;k<count&&mark==0;k++)
{
//当站点相同时用mark的值来结束循环,
if(station2.indexOf(all_station[k])!=-1||all_station[k].indexOf(station2)!=-1)
{ mark=1;
flag=0;
}
else
flag=1;//如果全都不相同时,用flag值来跟踪
} //endfor
//把不重复的站点放入数组中,count加一,
if(flag==1)
{ all_station[count]=station2;
count++;
}//endif
} //endwhile
} //endwhile
result2.close();
Arrays.sort(all_station, cmp);
} catch(Exception e) { }
%>
<table width="802" height="744" border="0" bgcolor="#FFFFFF">
<tr>
<td height="183" colspan="3"><TABLE width=800 height="179" border=0 align=center cellPadding=0 cellSpacing=0 bordercolor="#FFFFFF">
<TBODY>
<TR>
<TD height="30" colspan="7" bordercolor="#FF0000"><img src="Picture/top.files/top2004-p1.jpg" width="800" height="30"></TD>
</TR>
<TR>
<TD height="30" colspan="7" bordercolor="#FF0000"><img src="Picture/top.files/top2004-p2.jpg" width="800" height="30"></TD>
</TR>
<TR>
<TD height="41" colspan="7" bordercolor="#FF0000"><img src="Picture/top.files/top2004-p3.jpg" width="800" height="41"></TD>
</TR>
<TR>
<TD height="35" colspan="7" bordercolor="#FF0000"><img src="Picture/top.files/top2004-p4.jpg" width="800" height="35"></TD>
</TR>
<TR bordercolor="#FFFFFF">
<TD width=214
height=13 background="Picture/topbg.gif">
<P align=left> <FONT style="FONT-FAMILY: Verdana"
color=#ffffff>
<SCRIPT language=JavaScript class=black
src="css/date.js"></SCRIPT>
</FONT></P></TD>
<TD width="89" background="Picture/topbg.gif"><span class="style6">
<div align="center" class="style6"> <a href="http://www.0951.cc/tel/" target="_blank"><strong><strong></strong></strong></a><a href="homepage.jsp" target="_self"><strong><strong>| 首页 </strong></strong><strong> |</strong></a></div>
<a href="default.html" target="mainFrame"> </a><a href="http://www.0951.cc/adxx/tielu/" target="_blank">
<div align="center" class="style13"></div>
</a></span></TD>
<TD width="94" background="Picture/topbg.gif"><span class="style6"><a href="index.jsp" target="_self">
<div align="center" class="style13">|本站导航|</div>
</a></span></TD>
<TD width="98" background="Picture/topbg.gif"><div align="center" class="style13">|<a href="advancequery.jsp">高级搜索</a>|</div></TD>
<TD width="97" background="Picture/topbg.gif"><div align="center" class="style6"><strong><strong>|<a href="news.jsp">公交新闻</a>|</strong></strong></div></TD>
<TD width="101" background="Picture/topbg.gif"><div align="center" class="style6"><strong>|<a href="messages.jsp">留言板</a>|</strong></div></TD>
<TD width="107" background="Picture/topbg.gif"><div align="center" class="style6"><strong><a href="login.html" target="_parent">|系统维护|</a></strong></div></TD>
</TR>
<TR>
<TD
height=24 colspan="3" background="Picture/l33.gif" bgcolor="#6699FF"><marquee onMouseOver="fhhg" >
<code><strong>网内公告:欢迎访问南昌公交查询网站!</strong> </code>
</marquee>
</TD>
<TD
height=24 colspan="4" background="Picture/l33.gif" bgcolor="#FFFFFF"><div align="right" class="style6"><span class="style11"><A href="#" class=Bottom onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://localhost:8080/nbos/homepage.jsp');">|设为首页|</A><a href="javascript:window.external.AddFavorite('http://localhost:8080/nbos/homepage.jsp','南昌公交查询网')">加入收藏|</a><A href="mailto:software_wei@163.com" class=Bottom>联系站长</A><A href="mailto:software_wei@163.com" class=Bottom>|</A></span></div></TD>
</TR>
</TBODY>
</TABLE></td>
</tr>
<tr >
<td width="80" rowspan="6" bgcolor="#99CCFF"> </td>
<td height="143"><form action="resultquery1.jsp" method="post" name="form1" target="_blank"><table width="637" height="141" border="0" cellpadding="0" cellspacing="0" bordercolorlight="#0066FF">
<tr>
<td height="60" colspan="3"><div align="left"></div> <img src="Picture/R2004-t-1.gif" width="240" height="60"></td>
</tr>
<tr >
<td height="18" colspan="3" background="Picture/topbg.gif"><div align="center" class="STYLE7"><span class="STYLE4">查询方式一</span>:车次查询</div></td>
</tr>
<tr>
<td width="102" height="63" bgcolor="#e8f3ff" class="style17">请选择车次: </td>
<td width="256" bgcolor="#e8f3ff"><label>
<select name="query1" size="1" >
<option selected="selected">---请选择你要查询的车次---</option>
<% for(int k=0;k<i;k++)
{ %>
<option><%=busid[k]%></option>
<% } %>
</select>
</label></td>
<td width="279" bgcolor="#e8f3ff">
<input type="submit" name="search122" value="查 找" /></td>
</tr>
</table> </form></td>
<td width="84" rowspan="6" bgcolor="#99CCFF"></td>
</tr>
<tr>
<td width="628" height="62"><img src="Picture/R2004-t-2.gif" width="240" height="60"></td>
</tr>
<tr>
<td height="83"><form action="resultquery2.jsp" method="post" name="form1" target="_blank" id="form1">
<table width="635" height="81" >
<tr >
<td height="16" colspan="3" background="Picture/topbg.gif"><div align="center" class="STYLE7"><span class="STYLE4">查询方式二</span>:站点查询</div></td>
</tr>
<tr>
<td width="102" height="57" bgcolor="#e8f3ff" class="STYLE4 style16">请选择站点: </td>
<td width="251" bgcolor="#e8f3ff"><label>
<select name="query2" size="1" >
<option>火车站</option>
<% //循环输出全部站点
for(int j=0;j<count;j++) { %>
<option><%=all_station[j]%></option>
<% } %>
</select>
</label></td>
<td width="266" bgcolor="#e8f3ff"><input type="submit" name="search" value="查 找" /></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td height="62"><img src="Picture/R2004-t-3.gif" width="240" height="60"></td>
</tr>
<tr>
<td height="93"><form action="resultquery3.jsp" method="post" name="form1" target="_blank">
<table width="636" height="91" >
<tr>
<td height="16" colspan="4" background="Picture/topbg.gif"><div align="center" class="STYLE2"><span class="STYLE4">查询方式三</span>:精确查询</div></td>
</tr>
<tr bgcolor="#e8f3ff">
<td height="15" ><div align="center"><span class="style16">请选择起始站:</span></div></td>
<td height="15" > </td>
<td width="222" ><div align="center">
<label><span class="style16">请选择到达站:</span></label>
</div></td>
<td> </td>
</tr>
<tr bgcolor="#e8f3ff">
<td width="189" height="50" bgcolor="#e8f3ff"><div align="right"><span class="style8">
<select name="S_query3" size="1" >
<option selected="selected">火车站</option>
<% for(int m=0;m<count;m++) { %>
<option><%=all_station[m]%></option>
<% } %>
</select>
</span></div></td>
<td width="48" bgcolor="#e8f3ff" class="style15"><div align="center" class="style16">-></div></td>
<td><label>
<select name="E_query3" size="1" >
<option selected="selected">火车站</option>
<% for(int n=0;n<count;n++) { %>
<option><%=all_station[n]%></option>
<% } %>
</select>
</label> </td>
<td width="157" ><input type="submit" name="search2" value="查 找" /></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td height="17" background="Picture/bottombg.gif"> </td>
</tr>
<tr >
<td height="46" colspan="3" background="Picture/mainbottom.jpg"><%! Integer number=new Integer(0); %>
<% synchronized(number)
{ int COUNT=number.intValue();
COUNT++;
number=new Integer(COUNT);
}
%>
<div align="center">你是第 <%=number.intValue() %> 个访问本站的客户!</div></td>
</tr>
<tr background="Picture/topBar_bg.gif">
<td height="24" colspan="3"><div align="center"><span class="css">Copyright © 南昌公交查询网. All rights reserved 2007-2010</span></div></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -