📄 su_add.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(../Picture/index-top_2.gif);
margin-left: 50px;
}
.style1 {
font-size: 16px;
font-weight: bold;
}
-->
</style></head>
<body>
<% Statement sql=null,sql1=null;
ResultSet result,result1;
Connection con;
String detail=null;
String Station1=null;
String Station2=null;
String station[]=new String[2000];
String all_Detail[]=new String[2000];
String new_station[]=new String[500];
int i=0,j=0,count=0;
int flag=0,mark=0;
String busid=(String)session.getAttribute("add_busid");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{ e.printStackTrace(); }
try{ //out.println(busid);
con=DriverManager.getConnection("jdbc:odbc:nbos","","");
sql=con.createStatement();
String condition="select * from bus where BusID='"+busid+"'";
result=sql.executeQuery(condition);
if(result.next())
{ detail=result.getString(2);
//out.println(detail);
}
result.close();
StringTokenizer str=new StringTokenizer(detail,"->");
//把所添加车次的所有经过的站点放入station[i]中
while(str.hasMoreTokens())
{
station[i]=str.nextToken();
i++;
}
//从数据库取出与所添加车次不相同的所有车次信息
sql1=con.createStatement();
String condition1="select Detail from bus where BusID<>'"+busid+"'";
result1=sql1.executeQuery(condition1);
while(result1.next())
{ all_Detail[j]=result1.getString("Detail");
j++;
}
result1.close();
for(int k=0;k<i;k++)//i表示不断取所添加车次的每个站点进行比较
{ Station1=station[k];
//out.println(Station1);
mark=0;
for(int m=0;m<j&&mark==0;m++)
{
StringTokenizer str1=new StringTokenizer(all_Detail[m],"->");
while(str1.hasMoreTokens()&&mark==0)
{ Station2=str1.nextToken();
//out.println(Station2);
if(Station1.equals(Station2))
{ mark=1;
flag=0;
}
else
flag=1;
}
}
//如果是新站点,则把它存入new_station[]中
if(flag==1)
{ new_station[count]=Station1;
//out.println(new_station[count]);
count++;
//out.println("fdsafd");
}
} %>
<table width="438" border="1">
<tr background="../Picture/topbg.gif">
<td colspan="2" background="../Picture/topbg.gif"><div align="center" class="style1">车次添加成功</div></td>
</tr>
<tr>
<td height="31" colspan="2" background="../Picture/l33.gif">你已成功将<font color="FF0000"><%=busid%></font>路车车次信息添加到数据库,以下是添加的新车次号和新站点!继续添加<a href="add.jsp">点击这里</a></td>
</tr>
<tr>
<td height="24" background="../Picture/l33.gif"><div align="center"><strong class="style1">新车次号</strong></div></td>
<td height="24" background="../Picture/l33.gif"><div align="center"><strong class="style1">新站点</strong></div></td>
</tr>
<tr><% if(count>0)
{ %>
<td width="95" height="31" background="../Picture/l33.gif">
<div align="center"><%=busid%></div></td>
<td width="199" background="../Picture/l33.gif">
<div align="center">
<% for(int k=0;k<count;k++)
{
out.print(new_station[k]);
out.print(" ");
}%>
</div></td> <% }
else{ %><td width="54" height="17" background="../Picture/l33.gif">
<div align="center"><%=busid%></div></td>
<td width="62" height="17" background="../Picture/l33.gif"><div align="center">没有新站点</div></td>
<% } %>
</tr>
<tr background="../Picture/bottombg.gif">
<td height="17" colspan="2" background="../Picture/bottombg.gif"> </td>
</tr>
</table><%
} catch(Exception e){
e.printStackTrace();
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -