예제 #1
0
  @RequestMapping(value = "/editItemsSubmit.action", method = RequestMethod.POST)
  public String editItemSubmit(ItemsVo itemVo) throws Exception {

    service.UpdateItem(itemVo);

    return "redirect:/items/queryItems.action";
  }
예제 #2
0
  @RequestMapping("/editItems.action")
  public ModelAndView editItem(Integer id) throws Exception {

    Item currentItem = service.findItemById(id);

    ModelAndView mv = new ModelAndView();
    mv.addObject("currentItem", currentItem);
    mv.setViewName("items/editItems");

    return mv;
  }
예제 #3
0
  /*
   * 批量修改商品页面,将商品信息查询出来,在页面中可以编辑商品信息
   * 这里演示的是绑定List<T>数据
   */
  @RequestMapping("/editItemsQuery")
  public ModelAndView editItemsQuery(
      @RequestParam(value = "pageNo", required = false, defaultValue = "1") String pageNoStr,
      ItemsVo itemVo)
      throws Exception {

    int pageNo = 1;
    // 对pageNo的校验
    try {
      pageNo = Integer.parseInt(pageNoStr);
      if (pageNo < 1) {
        pageNo = 1;
      }
    } catch (Exception e) {
    }

    Page<Item> page = service.findItemList(itemVo, pageNo);

    ModelAndView mv = new ModelAndView();
    mv.addObject("page", page);
    mv.setViewName("items/editItemsQuery");
    return mv;
  }