Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在用java开发一个搜索引擎。它工作正常,但所有结果都显示在一个页面中。如何在谷歌等单独的页面中显示结果。如果我有 100 个结果,那么结果将显示在 10 页中,每页 10 个结果。我没有使用 MySQL。我的数据存储在文件中。
因此,您需要获取指定的页码并使用它来确定在该页面中首先显示的结果。
说你的网址看起来像这样
www.yoursite.com?search=JSP&page=3
然后,您将提取搜索词并找到结果。您还将获得请求的页面并使用它。
firstResultNum = page * resultsPerPage for (i=firstResultNum; i<firstResultNum+resultsPerPage; i++) { displayCurSearchResult(i); }