<%@page contentType="text/html; charset=Big5" %> <%@page import="com.arcotect.multizen.category.*, java.util.*" %> <%@page import="com.arcotect.multizen.product.*" %> <%@page import="com.arcotect.multizen.home.*" %> <%@taglib prefix="html" uri="/WEB-INF/struts-html.tld" %> <%@taglib prefix="bean" uri="/WEB-INF/struts-bean.tld" %> <%@taglib prefix="logic" uri="/WEB-INF/struts-logic.tld" %> <% request.setAttribute("homeContent", HomeContentDAO.getInstance().getHomeContent()); %> <% int start = 0; if( request.getParameter("start") != null ) start = Integer.parseInt(request.getParameter("start")); int categoryID = Integer.parseInt(request.getParameter("categoryID")); int total = ProductDAO.getInstance().countPublishedProductByCategoryID(categoryID); int length = 8; boolean hasNext = total > (start + length); boolean hasPrevious = ! (start == 0); request.setAttribute("currentCategory", CategoryDAO.getInstance().getCategory(categoryID)); request.setAttribute("products", ProductDAO.getInstance().getPublishedProductsByCategoryID(categoryID, start, length)); request.setAttribute("categories", CategoryDAO.getInstance().getAllCategory()); %> multizen asia limited
" WIDTH=95 HEIGHT=120>
" onmouseover="swapImage('c','on')" onmouseout="swapImage('c','off')" > " border="0" name="c">
<% // Total number of pages int numPages = 1; if (total % length != 0) { numPages = ((total - (total % length)) / length) + 1; } else { numPages = total / length; } // The current page number int curPage = (start / length) + 1; %>
Page <%= curPage %> of <%= numPages %>
<% int i = 1; %> <% if( i++ % 4 == 0 ) { %> <% } %> <% if( (i+1) % 4 > 0 ) { %> <% } %>
"> /" border="0">

Page: [  <% for (int j = 1; j <= numPages; j++) { if (curPage != j) { %> <%= j %>  <% } else { %> <%= j %>  <% } } %> ]  <% if (start != 0) { %> First <% } %> <% if (hasPrevious) { %> : Previous <% } %> <% if (hasNext) { %> <% if (start != 0) { %> : Next <% } else { %> Next <% } %> <% } %> <% if (numPages != curPage) {%> : Last <% } %>