📄 searchok.jsp~34~
字号:
<jsp:include flush="true" page="top.htm"/>
<%@page contentType="text/html; charset=GBK" import="java.util.*" %>
<%
request.setCharacterEncoding("GBK");
%>
<jsp:useBean id="gbdao" scope="page" class="com.netbar.dao.gbDao"/>
<%
//添加分页
int currentPage = 1; //当前页,初始为1
int recordRows = 10; //每页记录行数
int pageSize = 0; //总页数
int totalRecords;//表中总的记录数
String keyword= request.getParameter("keyword");
String className=request.getParameter("classname");
if(session.getAttribute("keyword")==null||session.getAttribute("keyword").equals("")){
session.setAttribute("keyword",keyword);
session.setAttribute("className",className);
}
if(keyword==null || keyword.equals("")){
keyword=(String)session.getAttribute("keyword");
className=(String)session.getAttribute("className");
}
//获取表中所有记录数。。
if(session.getAttribute("totalRecords")!=null){
String totalRecordstemp=(String)session.getAttribute("totalRecords");
totalRecords=Integer.parseInt(totalRecordstemp);
}else{
totalRecords = com.netbar.dao.gbDao.getSearchRecord(keyword,className);
session.setAttribute("totalRecords",totalRecords+"");
System.out.println("总记录数:"+totalRecords);
String tt=(String)session.getAttribute("totalRecords");
if(tt.trim().equals("0")){
response.sendRedirect("reSearch.jsp");
}
}
//计算取得总页数
if (totalRecords % recordRows == 0) {
pageSize = totalRecords / recordRows;
}
else {
pageSize = (totalRecords / recordRows) + 1;
}
String tempPage = request.getParameter("currentPage");
if (tempPage != "" && tempPage != null) {
currentPage = Integer.parseInt(tempPage);
}
String goPage = request.getParameter("goPage");
if (goPage != null) {
if (!goPage.equals("")) {
currentPage = Integer.parseInt(goPage);
}
}
//确认各页的起始和结束留言记录
int startRecord = recordRows*(currentPage - 1);
int stopRecord = startRecord + recordRows;
if (currentPage == pageSize) {
stopRecord = totalRecords;
}
%>
<%if (currentPage > pageSize) {%>
<script type="text/javascript">
alert("超过当前最多页数!");
</script><%
currentPage = 1;
startRecord = 0;
stopRecord = recordRows;
}
%>
<%if (currentPage < 1) {%>
<script type="text/javascript">
alert("您要查找的页数不能低于1!!!");
</script><%
currentPage = 1;
startRecord = 0;
stopRecord = recordRows;
}
%>
<html>
<head>
<title>中青网络会所>>留言本</title>
<meta name="Robots" content="all">
<meta name="Generator" content="Dreamweaver,ASP">
<meta name="copyright" content="Copyright 中青网络会所 2007-2008">
<meta name="Author" content="zqnet">
<meta name="description" content="中青网络会所留言本">
<meta name="keywords" content="留言本,中青">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css.css" rel="stylesheet" type="text/css">
<%--SCRIPT Language="JScript" SRC="xp_ubbcode.js" Runat=Server></SCRIPT--%>
<style type="text/css">
<!--
.style14 {color: #666666}
.style16 {
color: #0099FF;
font-weight: bold;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script><script type="text/javascript" language="javascript">
function check(){
gopage=this.go.goPage.value;
if(gopage==""){
alert("请输入您要跳转到的页面。");
this.go.goPage.focus();
return false;
}else{
return true;
}
}
</script></head>
<body background="images/bg_001.gif" bgproperties="fixed">
<table width="680" height="12" border="0" align="center" cellpadding="0" cellspacing="0" class="biao_bdr">
<tr>
<td>
<img src="images/bar_1.gif" width="678" height="20">
</td>
</tr>
</table>
<%
Vector vcs=new Vector();
if(session.getAttribute("vcs")!=null){
vcs=(Vector)session.getAttribute("vcs");
}else{
vcs = gbdao.getSelectData(keyword,className);
}
session.setAttribute("vcs",vcs);
//String title,content,reply,person,web,mail,qq,face,ip,pcname,time,redate;
//int id;
for (int i = startRecord; i < stopRecord; i++) {
com.netbar.bean.gbBean gbbean = (com.netbar.bean.gbBean)vcs.get(i);
int id = gbbean.getGbID();
String title = gbbean.getGbTitle();
String content = gbbean.getGbContent();
String reply = gbbean.getGbReply();
String person = gbbean.getGbPerson();
String web = gbbean.getGbWeb();
String mail = gbbean.getGbMail();
String qq = gbbean.getGbQQ();
String face = gbbean.getGbFace();
String ip = gbbean.getGbIP();
String pcname = gbbean.getGbPcname();
String time = gbbean.getGbTime();
String redate = gbbean.getGbRedate();
//将查询的关键字返红显示
if(session.getAttribute("keyword")!=null){
String classNames=(String)session.getAttribute("className");
if(classNames.equals("gbTitle")){
title=title.replaceAll(keyword,"<font color='red'>"+keyword+"</font>");
}
if(classNames.equals("gbPerson")){
person=person.replaceAll(keyword,"<font color='red'>"+keyword+"</font>");
}
if(classNames.equals("gbContent")){
content=content.replaceAll(keyword,"<font color='red'>"+keyword+"</font>");
}
if(classNames.equals("gbReply")){
reply=reply.replaceAll(keyword,"<font color='red'>"+keyword+"</font>");
}
}
//System.out.println(!reply.equals("暂无回复") + "\n\n\n\n\n");
%>
<table width="680" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#EBF2F8" class="biao_bdr" style="table-layout:fixed;word-break:break-all">
<tr>
<td width="140" rowspan="2" style="border-right: 1px solid #d1e0f0;">
<table width="98%" height="35" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div align="center">
<font style="FONT-SIZE: 10pt; FILTER: shadow(color=#C0C0C0); COLOR: #000000; HEIGHT: 1px"><%=person%> </font>
</div>
</td>
</tr>
</table>
<div align="center">
<%
if(!face.equals("images/admin.gif")){
%>
<img width="64" height="64" src="<%=face%>" alt="【<%=person%>】的ID为:<%=id%>">
<%}else{
%>
<img width="128" height="128" src="<%=face%>" alt="【<%=person%>】的ID为:<%=id%>">
<% }%>
<br>
</div>
<div align="center">
<table width="125" height="28" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div align="center">
<%if (qq.trim().length() != 0 && qq != null) { %>
<img src="images/oicq.gif" alt="QQ:<%=qq%>" width="16" height="16">
<%} %>
<%if (session.getAttribute("logined") != null) { %>
<img src="images/icon_ip.gif" alt="计算机名:<%=pcname%>" width="13" height="15">
<%} else { %>
<img src="images/icon_ip.gif" alt="IP:<%=ip%>" width="13" height="15">
<%} %>
<%if ((!mail.equals("")) && mail != null) { %>
<a href="mailto:<%=mail%>">
<img src="images/email.gif" alt="邮箱:<%=mail%>" width="16" height="16" border="0">
</a>
<%} %>
<%if (!web.equals("") && (!web.equals("http://")) && web != null) { %>
<a href="<%=web%>" target="_blank">
<img src="images/homepage.gif" alt="个人主页:<%=web%>" width="16" height="16" border="0">
<%} %>
<br>
</a>
</div>
</td>
</tr>
</table>
</div>
<div align="center">
<table width="96" border="0" cellspacing="0" cellpadding="0" style="table-layout:fixed;word-break:break-all">
<tr>
<td style="padding:4px;word-wrap: break-word"> </td>
</tr>
</table>
</div>
</td>
<td>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<strong>
<img src="images/more01.gif" width="15" height="14" border="0" align="middle">
<%=title %> </strong>
<table width="520" height="1" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#d1e0f0">
<tr>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="540" height="120" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="40">
<table width="520" height="50" align="center" cellspacing="0" cellpadding="0" border="0" style="table-layout:fixed;word-break:break-all">
<tbody>
<tr>
<td style="padding:4px;word-wrap: break-word">
<font style="FONT-SIZE: 10pt; FILTER: shadow(color=#C0C0C0); COLOR: #000000; HEIGHT: 1px"><%=content%> </font>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<div align="right">
<%if (session.getAttribute("logined") != null) { %>
<a href="res.jsp?id=<%=id%>" target="_self" style="color:red">回复</a>
|
<a href="del.jsp?id=<%=id%>" style="color:red">删除</a>
<%} %>
[
<strong><%=time%> </strong>
]
</div>
</td>
</tr>
<tr>
<td>
<p style="color: #0033CC">
<font style="FONT-SIZE: 10pt; FILTER: shadow(color=#c0c0c0); COLOR: blue; HEIGHT: 1px">
<%if (reply!=null && !reply.equals("暂无回复")) { %>
<img src="images/bb01.gif" width="21" height="14" border="0" align="absmiddle">
中青回复:
<%=reply%> </font>
</p>
<p style="color: #0033CC"> </p>
<p align="right" style="color: #0033CC">
<font style="FONT-SIZE: 10pt; FILTER: shadow(color=#c0c0c0); COLOR: blue; HEIGHT: 1px"> 回复日期:【
<%=redate%> 】
<br>
<%} %>
</font>
</p>
<p style="color: #0033CC"> </p>
<div align="right"> </div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%}%>
<table width="680" height="12" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#66CCFF" class="biao_bdr2">
<tr>
<td>
<div align="center">
<form action="#" name="go" method="POST" onsubmit="return check();"> 总计
<%=totalRecords%> 条
共有
<%=currentPage%> /
<%=pageSize%> 页
每页
<%= recordRows %> 条
<%if (currentPage != 1) { %>
<a href="searchok.jsp">首页</a>
<a href="searchok.jsp?currentPage=<%=currentPage-1%>">上一页</a>
<%} %>
<%if (currentPage != pageSize) { %>
<a href="searchok.jsp?currentPage=<%=currentPage+1%>">下一页</a>
<a href="searchok.jsp?currentPage=<%=pageSize%>">尾页</a>
<%} %>
<input type="text" size="2" name="goPage"/>
<input value="Go!" name="confirm" type="submit"/>
</form>
</div>
</td>
</tr>
</table>
<jsp:include flush="true" page="buttom.jsp"/>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -