📄 infosearchresult.jsp
字号:
<html>
<head>
<title>信息查询管理平台</title>
<link rel="stylesheet" href="images/css2.css" type="text/css" >
<%@ page import="java.util.*,java.sql.*,com.util.*" %>
<%@ page language="java" contentType="text/html;charset=gb2312"%>
<%
String KeyWord=ChangeEncode.Change(request.getParameter("KeyWord"));
String New=request.getParameter("New");
if(New==null)New="false";
Connection conn = DataBaseConnection.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = null;
int PageNo = 1;
if (request.getParameter("pageno") != null)
PageNo = Integer.parseInt(request.getParameter("pageno").trim());
int AllCount = 0; //记录总数
int PageSize = 20; //页面显示记录数
int PageCount = 0;
int rsshow = 0;
String infotitle = "";
String writetime = "";
String id = "";
try {
String sql="";
if (New.equals("true")){
session.removeAttribute("sql");
}
sql = "select * from DAZHE_info where infotitle like '%"+KeyWord+"%' order by infotitle";
if (session.getAttribute("sql") == null) {
session.setAttribute("sql", sql);
} else {
if (!session.getAttribute("sql").equals(sql)) {
sql = session.getAttribute("sql").toString().trim();
}
}
rs = stmt.executeQuery(sql);
while (rs.next()) {
++AllCount;
}
rs.close();
rs = null;
if (AllCount % PageSize == 0) {
PageCount = AllCount / PageSize;
} else {
PageCount = AllCount / PageSize + 1;
}
rsshow = (PageNo - 1) * PageSize;
rs = stmt.executeQuery(sql);
while (rsshow > 0) {
rs.next();
--rsshow;
}
%>
</head>
<body>
<table width="460">
<tr>
<th width="300">信息标题</th>
<th width="80">发布时间</th>
<th width="80">操 作</th>
</tr>
<%
while (rs.next() && PageSize > 0) {
PageSize--;
id = rs.getString("id");
infotitle = rs.getString("infotitle");
writetime = rs.getString("writetime");
out.println(" <tr align=\"center\">");
out.println(" <td align=\"left\">"+infotitle+"</td>");
out.println(" <td>"+writetime+"</td>");
out.println(" <td><a href=\"InfoRead.jsp?id="+id+"\">详细</a> | <a href=\"InfoDelete.jsp?id="+id+"\">删除</a></td>");
out.println(" </tr>");
}
rs.close();
} finally {
if(stmt!=null)
stmt.close();
if(conn!=null)
conn.close();
}
%>
<tr>
<td colspan="3" align="right">
<form name="form1" action="InfoSearchResult.jsp">
当前第<%=PageNo %>页/共<%=PageCount %>页 <a href="InfoSearchResult.jsp?pageno=1">首页</a>
<%
if(PageCount!=1&&PageNo!=1)out.println("<a href=\"InfoSearchResult.jsp?pageno="+(PageNo-1)+"\">上一页</a>");
if(PageCount!=1&&PageNo!=PageCount)out.println("<a href=\"InfoSearchResult.jsp?pageno="+(PageNo+1)+"\">下一页</a>");
%>
<a href="InfoSearchResult.jsp?pageno=<%=PageCount %>">尾页</a> 转到<input name="pageno" id="pageno" type="text" value="<%=PageNo %>" size="2"/>页 <input type="submit" value="转到"/>
</form>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -