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

📄 searchuser_post.jsp

📁 用Jsp实现的图书管理系统代码
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="../ch.jsp" %>
<%@ include file="checkadmin.jsp"%>
<jsp:useBean id="searchuser" class="conndb.DbConnBean" scope="request" />
<%
String sql="";
String keyword=request.getParameter("keyword");
String tkeyword=searchuser.chStr(keyword);//解决中文乱码
String keytype=request.getParameter("type");
if(keytype.equals("borrowid")){sql="select * from [user] where borrowID like '%"+tkeyword+"%'";}
else if(keytype.equals("username")){sql="select * from [user] where name like '%"+tkeyword+"%'";}
int temp=searchuser.select(sql);
Connection conn=searchuser.getConn();
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(sql);
String color="#CCCCCC";
int id=0;
%>
<!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>
</head>

<body> <% if(temp==0){out.println("对不起,没有查到相关借书证用户,请<a style=cursor:hand onclick=javascript:history.back();><b>重新查找</b></a>.");}else{ %> 
借书证用户查询结果
<table width="80%"  border="1" cellpadding="0" cellspacing="0" bordercolor="#99CCCC">
  <tr bgcolor="#00CCCC">
    <td width="7%" align="left"><strong> 序号</strong></td>
    <td width="13%" align="center"><strong> 姓名 </strong></td>
    <td width="7%" align="center"><strong> 年龄</strong></td>
    <td width="47%" align="center"><strong> 系别班级</strong></td>
    <td width="19%" align="center"><strong> 借书证号</strong></td>
    <td width="7%" align="center"><strong>性别</strong></td>
  </tr>
  <%
while(rs.next()){
String username=rs.getString(2);
String sex=rs.getString(3);
int age=rs.getInt(4);
String department=rs.getString(5);
String borrowid=rs.getString(6);

id++;
if(color=="#CCCCCC"){color="#999999";}
else{color="#CCCCCC";}
%>
  <tr bgcolor=<%=color%>>
    <td align="center"><%=id%></td>
    <td><%=username%></td>
    <td align="center"><%=age%></td>
    <td><%=department%></td>
    <td><%=borrowid%></td>
    <td align="center"><%=sex%></td>
  </tr>
  <%}}%>
  <tr bgcolor="#99FFCC">
    <td colspan="6"><center>
        当前查询结果中有借书证用户<%= id %>人
    </center></td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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