コード例 #1
0
  @RequestMapping(value = "/inspOperationEdit", method = RequestMethod.GET)
  public String inspOperationEdit(
      @ModelAttribute("inspOperationCmd") InspOperationBean inspEdit,
      HttpServletRequest request,
      HttpServletResponse response,
      Model model) {
    response.setCharacterEncoding("UTF-8");
    int id = Integer.parseInt(request.getParameter("inspOperationId"));
    List<InspOperationBean> inspOperationBean = new ArrayList<InspOperationBean>();
    List<InspOperationStep> stepList = new ArrayList<InspOperationStep>();
    InspOperationBean isp = null;
    try {
      obj = inspOperService.searchInspOperationWithId(id);
      Iterator<Object> iterator = obj.iterator();
      while (iterator.hasNext()) {
        Object obj = iterator.next();
        isp = (InspOperationBean) obj;
        List<InspOperationStep> step = isp.getInspOprStep();
        Iterator<InspOperationStep> itr = step.iterator();
        while (itr.hasNext()) {
          Object ob = (Object) itr.next();
          InspOperationStep ios = (InspOperationStep) ob;
          stepList.add(ios);
        }

        isp.setInspOprStep(stepList);
        inspOperationBean.add(isp);
      }
      model.addAttribute("inspOperationCmd", isp);
      request.setAttribute("inspOperationEdit", inspOperationBean);
      request.setAttribute("stepList", stepList);

    } catch (Exception e) {

      e.printStackTrace();
    } finally {
      obj = null;
    }
    return "inspOperationHome";
  }