<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; String currentQuery=(String) request.getAttribute("currentQuery"); int currentPage=(Integer) request.getAttribute("currentPage"); String[] titles=(String[]) request.getAttribute("titles"); String[] urlPaths=(String[]) request.getAttribute("urls"); String[] contents = (String[]) request.getAttribute("contents"); int totalNum = Integer.parseInt(request.getAttribute("totalNum").toString()); long times = Long.parseLong(request.getAttribute("times").toString()); String suggest = (String)request.getAttribute("suggest"); String[] recommendation = (String[])request.getAttribute("recommendation"); System.out.println("totalNum="+request.getAttribute("totalNum")); %> <%=currentQuery.length()>8?currentQuery.substring(0,8)+"...":currentQuery%>
>

为您推荐
<%for(int i=0;i<10;i++){if(recommendation[i]!=null){%> <%=String.valueOf(i + 1) + " " + recommendation[i]%>
<%}}%>

<%if(currentPage>1){ %> 上一页 <%}; %> <%for (int i=Math.max(1,currentPage-5);i <%=i%> <%}; %> <%=currentPage%> <%for (int i=currentPage+1;i<=Math.min(currentPage+5, (totalNum-1)/10+1);i++){ %> <%=i%> <%}; %> 下一页