Exemplo n.º 1
0
  // 加载主界面
  public String index() {
    try {

      //			@SuppressWarnings("deprecation")
      //			String path = ServletActionContext.getRequest().getRealPath("/");
      //
      //			System.out.println("path:"+path);

      list = productService.searchNumList(6);

      for (int i = 0; i < 6; i++) {
        getProductid()[i] = list.get(i).getId();
        getPos()[i] = list.get(i).getFirPicPosition();
        getPrice()[i] = list.get(i).getPrivce();
        getN()[i] = list.get(i).getName();
      }

      System.out.println("id+" + productid[0]);

      return "list";

    } catch (Exception e) {
      System.out.println(e.getMessage());
      e.printStackTrace();
    }

    return "list";
  }
Exemplo n.º 2
0
  // 获取某商品详情
  public String productInfo() {
    try {
      this.product = productService.findproductById(pid);
      System.out.println("id:" + product.getFirPicPosition());
      for (int i = 1; i <= 4; i++) {
        getPos()[i] = product.getFirPicPosition() + "s" + i + ".jpg";
      }

      price[0] = this.product.getPrivce();

      return "moreinfo";

    } catch (Exception e) {
      System.out.println(e.getMessage());
      e.printStackTrace();
    }

    return "moreinfo";
  }