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

📄 search.jsp

📁 jive3论坛开源 最新 有版主功能 jive3论坛开源 最新 有版主功能 jive3论坛开源 最新 有版主功能
💻 JSP
字号:
<%/** *	$RCSfile: search.jsp,v $ *	$Revision: 1.5 $ *	$Date: 2002/09/30 20:22:27 $ */%><%@ page import="java.util.*,                 com.jivesoftware.util.*,                 com.jivesoftware.forum.*,                 com.jivesoftware.forum.util.*,                 com.jivesoftware.base.*"    errorPage="error.jsp"%><%  // Page Description:    //    // This page handles logging into the system as well as logouts.%><%  // global.jsp - see description on index.jsp %><%@ include file="global.jsp" %><%  // Get parameters:    // The forum ID (optional)    long forumID = ParamUtils.getLongParameter(request,"forum",-1L);    // The query    String queryText = ParamUtils.getParameter(request,"q");    // The starting index of results to show:    int start = ParamUtils.getIntParameter(request,"start",0);    // The number of results to show per page:    int range = 15;    // Optionally load a forum:    Forum forum = null;    try {        forum = forumFactory.getForum(forumID);    }    catch (ForumNotFoundException ignored) {}%><%@ include file="header.html" %><jsp:include page="breadcrumbs.jsp" flush="true">    <jsp:param name="forum" value="<%= String.valueOf(forumID) %>" /></jsp:include><p>Use the form below to search the forum content.</p><form action="search.jsp" name="searchform"><input type="hidden" name="forum" value="<%= forumID %>"><table id="search-form" cellpadding="2" cellspacing="2" border="0" align="center"><tr>    <td class="label">        Search For:    </td>    <td>        <input type="text" name="q" size="60" maxlength="150">    </td></tr><tr>    <td colspan="2" align="center" nowrap>        <br>        <input type="submit" value="Search!" class="main-button">        <input type="submit" value="Cancel" name="cancel" class="cancel-button">    </td></tr></table></form><%  if (queryText != null) {        // If a query was submitted, try running a search. First, create a        // Query object and populate it (we fully qualify the Query object name        // because some appservers have classes already named "Query"):        com.jivesoftware.forum.Query query = null;        // Next, determine if this is a global or local search. A global search        // searches over all categories and forums and a local one will just search        // a single forum. If the forum object is not null that means we should        // search on a forum, otherwise we'll search globally. We specify these types        // of searches based on how we create a query object:        if (forum != null) {            // local search:            query = forum.createQuery();        }        else {            query = forumFactory.createQuery();        }        // Now, set the query text:        query.setQueryString(queryText);        // Execute the query - this returns an Iterator of ForumMessages. Limit the        // number of results we get to 'range' results and specify the starting        // index of results (this allows us to paginate through the results):        Iterator results = query.getResults(start, range);        // If there were no results, print out a message:        if (!results.hasNext()) {%>    <p class="search-noresults">    No results for "<%= queryText %>" - please try different search terms.    </p><%    }    else {        // First, print a summary of the results:%>    <p>    Results: <%= query.getResultCount() %>, showing <%= range %> page page:    </p>    <%  // Now, loop through all the results:        int counter = start;        while (results.hasNext()) {            ForumMessage message = (ForumMessage)results.next();            counter ++;            ForumThread searchThread = message.getForumThread();            Forum searchForum = searchThread.getForum();    %>        <table class="search-result" cellpadding="2" cellspacing="2" border="0" width="100%">        <tr valign="top">            <td width="1%">                <%= counter %>)            </td>            <td width="99%">                <a href="thread.jsp?forum=<%= searchForum.getID() %>&thread=<%= searchThread.getID() %>"                 ><%= message.getSubject() %></a>            </td>        </tr>        </table><%            } // end of results while loop        } // end of else    } // end of if%><script language="JavaScript" type="text/javascript"><!--document.searchform.q.focus();//--></script><%@ include file="footer.html" %>

⌨️ 快捷键说明

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