📄 search.jsp
字号:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="law.user" %>
<%@ page import="java.sql.*"%>
<%!
public String codeString(String s){
String str=s;
try{
byte b[]=str.getBytes("ISO-8859-1");
str=new String (b);
return str;
}catch(Exception e){return str;}
}
%>
<html>
<head><title>search</title></head>
<body>
<center>
<jsp:useBean id="log" class="law.user" scope="session"/>
<%@ include file="head.txt"%>
<%
if(log.getLogin().equals("true")){
String submit=request.getParameter("submit");
if(submit==null){
%>
<form action="search.jsp" method="post" name="form">
按照添加资料人搜索:<input type="text" name="id">
<input type="submit" name="submit" value="查询">
</form>
<%
}
else {
submit=codeString(submit);
if(submit.equals("查询")){
String id=request.getParameter("id");
if(id==null)id="";
id=codeString(id);
Connection con;
Statement sql;
ResultSet rs;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:law","","");
sql=con.createStatement();
String condition="SELECT * FROM data where id='"+id+"'";
rs=sql.executeQuery(condition);
%>
<table border=1 width=800>
<tr>
<td width=100 align=center>档案序号</td>
<td width=300 align=center>建立时间</td>
<td width=200 align=center>建立用户</td>
<td width=100 align=center>查阅</td>
<td width=100 align=center>删除</td>
</tr>
<%
while(rs.next()){
long num=rs.getLong("num");
%>
<tr>
<td width=100 align=center><%=num%></td>
<td width=300 align=center><%=rs.getString("time")%></td>
<td width=200 align=center><%=rs.getString("id")%></td>
<td width=100 align=center><a href="item.jsp?num=<%=num%>">查阅</a></td>
<td width=100 align=center><a href="delete.jsp?num=<%=num%>">删除</a></td>
</tr>
<%
}
%>
</table>
<%
con.close();
}catch(SQLException e){
out.println(e);
}catch(ClassNotFoundException e){
out.println(e);
}
}
else{
out.print("<font color=#FF0000>您在做什么?");
}
}
}
else{
out.print("<font color=#FF0000>您还没有登录。<br><a href='index.htm'>首页 </a>");
}
%>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -