⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.jsp

📁 基于JSP的公交查询系统,很好用的,适于学习,操作语句全在jsp页面里
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.util.*" %>
<!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;
}
.STYLE21 {font-style: normal; line-height: normal; font-weight: bold; color: #0066CC; font-family: "新宋体";}
.STYLE61 {font-style: normal; line-height: normal; font-weight: bold; color: #0066CC; font-family: "新宋体"; font-size: 12px; }
.style9 {color: #000000}
.style63 {font-size: medium; color: #000000; }
.style64 {font-size: medium}
.style65 {line-height: normal; color: #000000; font-family: "新宋体"; font-size: medium; font-style: normal;}
.style66 {font-size: large}
-->
</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;  //标识符,用来跟踪程序的执行.
 //加载数据源
	
try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	     }
		catch(ClassNotFoundException e){}
		 
	try{  
	      con=DriverManager.getConnection("jdbc:odbc:nbos","","");
	      Statement sql1=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); 
		  statement1="select * from bus order by BusID ASC";
		  result1=sql1.executeQuery(statement1);
		  while(result1.next())
		     { busid[i]=result1.getString("BusID");
			   i++;
			  }  
			    result1.close();
		  
	      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,"->");
			     while(str.hasMoreTokens())
		            { all_station[count]=str.nextToken();
					  count++;
					 }//endwhile
			  }//endif
			  //遍历数据库,把所有站点不重复地放入数组all_station[]数组中
			   while(result2.next())
			    {   //把每一条记录放入临时变量detail中
				   detail=result2.getString("Detail");
			        StringTokenizer str1=new StringTokenizer(detail,"->");
				    //对每一条记录的每一个站点进行比较
					while(str1.hasMoreTokens())
				       { mark=0;//恢复mark的值,以便比较下一条记录
					    station2=str1.nextToken();
					    //注:count是随着程序的执行而不断的增加
						 for(int k=0;k<count&&mark==0;k++)
						  { station1=all_station[k];
					        //当站点相同时用mark的值来结束循环,
							if(station1.equals(station2))
						      { mark=1;
							    flag=0;
							  }
							  else
							    flag=1;//如果全都不相同时,用flag值来跟踪
						  }	//endfor   
		                  //把不重复的站点放入数组中,count加一,
		                  if(flag==1)
						    {  all_station[count]=station2;
							   count++;
							   
							 }//endif
					    } //endwhile	
				  }	//endwhile
			result2.close();
			
	  } catch(Exception e) {  }
	  
	  
	
		    
		 
  
   
	    
				 
				  %>		 
  <table width="802" height="578" border="0" bgcolor="#FFFFFF">
    <tr>
      <td height="181"><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>
            <td width=210
          height=13   background="Picture/topbg.gif">
              <p align=left>&nbsp;&nbsp;<font style="FONT-FAMILY: Verdana" 
            color=#ffffff>
                <script language=JavaScript class=black 
             src="css/date.js"></script>
            </font></p></td>
            <td width="88" bordercolor="#FF0000" 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="87" bordercolor="#FF0000" background="Picture/topbg.gif"><span class="style6"><a href="index.jsp" target="_self">
              <div align="center" class="style13">|本站导航|</div>
            </a></span></td>
            <td width="104" bordercolor="#FF0000" background="Picture/topbg.gif"><div align="center" class="style13"><a href="advancequery.jsp">|高级搜索|</a></div></td>
            <td width="86" bordercolor="#FF0000" background="Picture/topbg.gif"><div align="center" class="style6"><strong><strong>|<a href="news.jsp">公交新闻</a>|</strong></strong></div></td>
            <td width="105" bordercolor="#FF0000" background="Picture/topbg.gif"><div align="center" class="style6"><strong>|<a href="messages.jsp">留言板</a>|</strong></div></td>
            <td width="120" bordercolor="#FF0000" background="Picture/topbg.gif"><div align="center" class="style6"><strong><a href="login.html" target="_parent">|系统维护|</a></strong></div></td>
          </tr>
          <tr background="Picture/l33.gif">
            <td
          height=24 colspan="3" background="Picture/l33.gif"><marquee >
              <code><strong>网内公告:欢迎访问南昌公交查询网站!</strong> </code>
            </marquee>            </td>
            <td
          height=24 colspan="4"  background="Picture/l33.gif"><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 height="325" bgcolor="#99CCFF"><div align="center">
        <table width="659" height="329"  border="1" bordercolor="#000000" bordercolorlight="#0066FF" background="Picture/l33.gif" bgcolor="#FFFFFF">
          <tr bgcolor="#e8f3ff" class="style11" background="Picture/topbg.gif">
            <td height="17" colspan="2" class="STYLE61"><p align="center" class="wordstyle STYLE8 style9 style66">本站导航</p></td>
          </tr>
          <tr bgcolor="#e8f3ff" class="style11">
            <td height="19" colspan="2" class="STYLE61">&nbsp;</td>
          </tr>
          <tr bgcolor="#e8f3ff" class="style11">
            <td width="88" height="37" class="STYLE61"><div align="center" class="style9">查询方式一:</div></td>
            <td width="561" class="style63"><div align="left">点击下拉框,在下拉框中选中你要查询的车次号,该功能将显示该车次经过的所有站点。 </div></td>
          </tr>
          <tr bgcolor="#e8f3ff" class="style11">
            <td height="43" class="STYLE61"><div align="center" class="style9">查询方式二:</div></td>
            <td class="STYLE6 style9 style64"><div align="left">点击<span style="font-family:"新宋体"; font-style: normal;" #invalid_attr_id="normal"><span class="wordstyle ">下拉框,在下拉框</span></span>中选中你要查询的站点,该功能将显示所有经过要查询站点的车次号。</div></td>
          </tr>
          <tr bgcolor="#e8f3ff" class="style11">
            <td height="84" class="STYLE61"><div align="center" class="style9">查询方式三:</div></td>
            <td class="style65"><div align="left">点击<span style="font-family:"新宋体"; font-style: normal;" #invalid_attr_id="normal"><span class="wordstyle ">下拉框,在下拉框</span></span>中选中你要查询的起点站和终点站,该功能将显示所有到达的途径,如果没有直达车,将为你建议若干中转站。</div></td>
          </tr>
          <tr bgcolor="#e8f3ff" class="style11">
            <td height="58" class="STYLE61"><div align="center" class="style9">其他说明:</div></td>
            <td height="58" ><p align="left" class="style63">本站以服务全民为中心,除了为你提供公交查询外,还为你提供相关的友情链接,如汽车查询,航班查询等。欢迎使用南昌公交查询系统!如果你对我们的服务不满,请拔打0791-7113763投拆。</p></td>
          </tr>
        </table>
      </div></td>
    </tr>
    <tr >
      <td height="38" background="Picture/mainbottom.jpg">          <div align="center"></div></td>
    </tr>
    <tr background="Picture/topBar_bg.gif">
      <td height="24"><div align="center"><span class="css">Copyright &copy; 南昌公交查询网. All rights reserved 2007-2010</span></div></td>
    </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -