📄 searchresult.jsp
字号:
<%--
- $Author: 飞鱼
- $Revision: 1.22 $
- $Date: 2003/02/01 09:41:34 $
- http://www.hnedu.net/fiyu
--%>
<%@ page contentType="text/html;charset=utf-8" %>
<%@ page errorPage="fatalerror.jsp"%>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="fiyucore.util.ParamUtil" %>
<%@ page import="fiyucore.util.StringUtil" %>
<%@ page import="fiyucore.filter.EnableEmotionFilter" %>
<%@ page import="fiyuforum.db.*" %>
<%@ page import="fiyuforum.MyUtil" %>
<%@ page import="fiyuforum.fiyuForumGlobal" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ include file="inc_common.jsp"%>
<html >
<head>
<title><%=fiyuForumConfig.getWebName()%> - 搜寻结果</title>
<%@ include file="/fiyuplugin/fiyuforum/meta.jsp"%>
</head>
<link href="<%=contextPath%>/fiyuplugin/fiyuforum/css/style.css" rel="stylesheet" type="text/css">
<body leftmargin="0" topmargin="0">
<%@ include file="header.jsp"%>
<br/>
<table width="95%" align="center">
<tr class="nav">
<td><img src="<%=contextPath%>/fiyuplugin/fiyuforum/images/nav.gif"></td>
<td width="100%" nowrap> <a class="nav" href="index"><%=fiyuForumConfig.getWebName()%></a> »
<a class="nav" href="search">搜寻</a> » 搜寻结果 </td>
</tr>
</table>
<br/>
<%
int totalPosts = ((Integer)request.getAttribute("TotalPosts")).intValue();
Collection postBeans = (Collection) request.getAttribute("PostBeans");
CategoryCache categoryCache = CategoryCache.getInstance();
ForumCache forumCache = ForumCache.getInstance();
%>
<table width="95%" align="center">
<tr>
<td class="hightlight">本次搜询所找到的文章 : <%=totalPosts%></td>
</tr>
</table>
<table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center">
<tr class="theader">
<td colspan="2">文章</td>
<td>讨论区</td>
<td align="center">发表日期</td>
</tr>
<%
boolean odd = false;
Iterator iterator = postBeans.iterator();
while(iterator.hasNext()) {
odd = !odd;
PostBean postBean = (PostBean)iterator.next();
%>
<%if (odd) {%>
<tr class="trow1">
<%} else {%>
<tr class="trow2">
<%}%>
<td width="16"><%=EnableEmotionFilter.filter(postBean.getPostIcon(), ParamUtil.getContextPath() + fiyuForumGlobal.EMOTION_DIR)%></td>
<td>
<a class="messageTopic" href="viewthread?thread=<%=postBean.getThreadID()%>#<%=postBean.getPostID()%>">
<%=MyUtil.filter(postBean.getPostTopic(), false/*html*/, true/*emotion*/, false/*fiyuCode*/, false/*newLine*/, false/*URL*/)%></a>
<br/>
<%=MyUtil.filter(StringUtil.getShorterString(postBean.getPostBody()), false/*html*/, true/*emotion*/, false/*fiyuCode*/, false/*newLine*/, false/*URL*/)%>
</td>
<td><a class="messageTopic" href="listthreads?forum=<%=postBean.getForumID()%>"><%=forumCache.getBean(postBean.getForumID()).getForumName()%></a></td>
<td align="center">
<%=onlineUser.getGMTTimestampFormat(postBean.getPostCreationDate())%><br>由
<a href="viewmember?member=<%=postBean.getMemberName()%>" class="memberName"><%=postBean.getMemberName()%></a>
</td>
</tr>
<%
}//while
if (totalPosts == 0) {
%>
<tr class="trow1"><td colspan="4" align="center"><b>找不到和你输入的条件相符的资料,请重新搜寻</b></td></tr>
<%}%>
</table>
<%if (totalPosts > 0) {%>
<p align="center" class="messageText">页:
<%
int offset = ((Integer)request.getAttribute("offset")).intValue();
int rows = ((Integer)request.getAttribute("rows")).intValue();
int forumID = ((Integer)request.getAttribute("forum")).intValue();
String key = (String)request.getAttribute("key");
String searchMemberName = (String)request.getAttribute("member");
int limit = 10* rows;
int leftLimit = offset - limit;
if (leftLimit < 0) leftLimit = 0;
int rightLimit = offset + limit;
if (rightLimit > (totalPosts-1)) rightLimit = totalPosts-1;
int previousOffset = offset - rows;
int nextOffset = offset + rows;
if (previousOffset >= leftLimit) {%>
<a href="<%=getSearchLink(previousOffset, totalPosts, rows, key, searchMemberName, forumID)%>"><img src="<%=contextPath%>/fiyuplugin/fiyuforum/images/icon/left.gif" border="0" alt="上一页"></a>
<% }
for (int i = leftLimit; i <= rightLimit; i += rows) {
int pageIndex = i/rows + 1;
if (offset == i) {
out.print("" + pageIndex + " ");
} else {
%>
<a href="<%=getSearchLink(i, totalPosts, rows, key, searchMemberName, forumID)%>"><%=pageIndex%></a>
<%
}//else
}//for
if (nextOffset <= rightLimit) {%>
<a href="<%=getSearchLink(nextOffset, totalPosts, rows, key, searchMemberName, forumID)%>"><img src="<%=contextPath%>/fiyuplugin/fiyuforum/images/icon/right.gif" border="0" alt="下一页"></a>
<% } %>
</p>
<%}%>
<%!
String getSearchLink(int offset, int totalPosts, int rows, String key, String memberName, int forumID) {
return "searchprocess?offset=" + offset + "&key=" + key + "&member=" + memberName + "&forum=" + forumID + "&rows=" + rows;
}
%>
<br/>
<%@ include file="footer.jsp"%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -