示例#1
0
  // 根据审核状态查找商品列表
  public String findAllByAudited() {
    setMessage(null);
    boolean audited = false;

    try {
      audited = Boolean.parseBoolean(getParameter("audited"));
    } catch (Exception e) {
    }

    List<Product> products = productManager.findAllByAudited(audited);

    if (products == null || products.size() == 0) {
      setMessage("没有符合条件的商品列表");
    }

    setAttribute("products", products);

    setTitle(audited ? "已审核商品列表" : "未审核商品列表");

    return SUCCESS;
  }
示例#2
0
  // 所有商品列表(已审核)
  public String list() {
    setMessage(null);
    setTitle("所有商品列表");
    int currentPage = getParameterInt("page");

    PageBean pageBean = new PageBean();
    pageBean.setCurrentPage(currentPage);
    pageBean.setPageCount(2);
    pageBean.setRecordCount((int) productManager.getProductCountByAudited(true));
    pageBean.setPageUrl("product/list.action");
    setAttribute("pageBean", pageBean);

    setAttribute(
        "products", productManager.findAllByAudited(true, currentPage, pageBean.getPageCount()));

    if ("true".equalsIgnoreCase(getParameter("ajax"))) {
      return "ajax";
    }

    return SUCCESS;
  }