Пример #1
0
  public String listAllNews() {
    HttpServletRequest request = getRequest();
    String pageIndex = request.getParameter("page");
    int pageSize = 10;
    PageInfo pageInfo = createPageInfo();
    pageInfo.setPageSize(pageSize);
    this.goodList = this.goodService.select(new Good());
    if (pageIndex == null) {
      pageInfo.setPageIndex(1);
    } else {
      pageInfo.setPageIndex(Integer.parseInt(pageIndex));
    }
    try {
      if (this.information == null) {
        this.information = new Information();
      }
      this.informationList = this.informationService.select(new Information());

      this.information.setEcommunity("1");
      this.inforAllList = this.informationService.pageList(pageInfo, this.information, true);
    } catch (Exception e) {
      e.printStackTrace();
    }
    if ((pageInfo.getCount() > 0) && (pageInfo.getCount() % pageSize != 0)) {
      pageInfo.setPageCount(pageInfo.getCount() / pageSize + 1);
    } else {
      pageInfo.setPageCount(pageInfo.getCount() / pageSize);
    }
    request.setAttribute("pageInfo", pageInfo);
    return "listAllNews";
  }
Пример #2
0
  public String newnews() {
    HttpServletRequest request = getRequest();
    String pageIndex = request.getParameter("page");
    int pageSize = 10;
    PageInfo pageInfo = createPageInfo();
    pageInfo.setPageSize(pageSize);
    if (pageIndex == null) {
      pageInfo.setPageIndex(1);
    } else {
      pageInfo.setPageIndex(Integer.parseInt(pageIndex));
    }
    this.goodList = this.goodService.select(new Good());

    this.advertiseList = this.advertiseService.getAdvertiseList();
    Information inf = new Information();
    inf.setType("0");
    this.inforAllList = this.informationService.pageList(pageInfo, inf, true);
    if ((pageInfo.getCount() > 0) && (pageInfo.getCount() % pageSize != 0)) {
      pageInfo.setPageCount(pageInfo.getCount() / pageSize + 1);
    } else {
      pageInfo.setPageCount(pageInfo.getCount() / pageSize);
    }
    request.setAttribute("pageInfo", pageInfo);

    this.informationList = this.informationService.select(new Information());
    return "newnews";
  }