Example #1
0
  public void doBuildTemplate(RunData runData, Context context) throws Exception {
    runData.setLayoutTemplate("Shop.html");

    ProductManager productManager =
        (ProductManager) MyBusinessFactory.getManager(AppConstants.ProductManager);

    List<BCategory> list = productManager.getCategoryList();
    context.put("catlist", list);

    long id = runData.getParameters().getLong("id", 0);
    BProduct po = productManager.getProductById(id);

    if (po != null) {
      ProductValue pv = getProductValue(po, runData);
      context.put("book", pv);
      context.put("catid", pv.getCatid());
    }
    context.put("cat", productManager.getCatnameMap());
    context.put("date", DateUtils.getInstance());
  }
Example #2
0
 private ProductValue getProductValue(BProduct po, RunData data) {
   ProductValue item = new ProductValue();
   item.setId(po.getId());
   item.setBookname(po.getBookname());
   if (po.getBookpubdate() != null) {
     item.setBookpubdate(new Date(po.getBookpubdate().getTime()));
   }
   item.setBookpublish(po.getBookpublish());
   item.setBookwriter(po.getBookwriter());
   item.setCatid(po.getCatid());
   item.setIntroduce(po.getIntroduce());
   item.setIscommend(po.getIscommend());
   item.setIspopulate(po.getIspopulate());
   item.setNum(po.getNum());
   String picname = CommonBean.getProductImgContextpath(data) + po.getPicname();
   item.setPicname(picname);
   item.setPrice(po.getPrice());
   item.setPubdate(po.getPubdate());
   item.setPubman(po.getPubman());
   item.setState(po.getState());
   return item;
 }