结对作业(地铁项目)06

lineserchjudge.jsp

<%@ page language="java" import="java.sql.*"  contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>查询</title>
</head>
<body style="text-align:center" >

查询结果

<video src="images/4.mp4" class="vedio" autoplay loop ></video>
<style>

td{
width: 80px;
height: 5px;
}


table, th, td {
border: 1px solid black;
margin-left: auto;
margin-right: auto;
border-collapse: collapse;
width: 500px;
text-align: center;
font-size: 20px;


}
body {

margin:0px;
background: url(images/2.png) no-repeat;
background-size:100% 100%;
background-attachment:fixed;
}
input {
width: 250px;
height: 44px;
border: none;
/* 元素周围的轮廓无效 */
outline: none;
/* 为元素指定的任何内边距和边框都将在已设定的宽度和高度内进行绘制 */
box-sizing: border-box;
display: block;
padding: 0 16px;
}
.input-text {
margin: 5px auto;
border-radius: 16px;
}

.input-text:hover {
border: 0.5px solid rgb(76, 76, 233);
transition: 0.5s;
border-radius: 4px;
}
</style>
<jsp:useBean id="util" class="User.subway" scope="page" />
<%
String line=(String)request.getParameter("line_name");
if(line==""){
out.print("<script language='javaScript'> alert('输入为空'); window.history.back(-1); </script>");
}
else
{
%>
<table border="1"style="text-align:center;">
<tr>
<td align="center" width=6%>线路</td>
<td align="center" width=3%>站点</td>

</tr>
<%
int i=0;
Connection connection = util.getConnection();
PreparedStatement preparedStatement=null;
ResultSet rs=null;
try {
String sql= " select * from bj_subway ";
preparedStatement=connection.prepareStatement(sql);
rs=preparedStatement.executeQuery();
while(rs.next())
{
i++;
if (line.equals(rs.getObject(2))){

%>
<tr>
<td align="center"><%=rs.getObject(2) %></td>
<td align="center"><%=rs.getObject(3) %></td>
</tr>
<%
}
}
if(i==0)
{
out.print("<script language='javaScript'> alert('没有查询到有关信息'); window.history.back(-1); </script>");
}


} catch (SQLException e) {
e.printStackTrace();
}finally{
util.close(rs);
util.close(preparedStatement);
util.close(connection);
}
}
%>
</table>

<p style="text-align:center;color: black; font-family: 宋体; font-size: 20px">
<br> <input class="input-text" type="button" value="返回菜单" onclick="location.href='menu.jsp'" />
</p>
</body>
</html>
posted @   平安喜乐×  阅读(4)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
· 为什么 退出登录 或 修改密码 无法使 token 失效
点击右上角即可分享
微信分享提示