コード例 #1
0
 @RequestMapping(value = "/delete.do")
 public ModelAndView guestDelete(@RequestParam("idx") int data) {
   System.out.println("ModelAndView guestDelete(int)");
   ModelAndView mav = new ModelAndView();
   dao.dbDelete(data);
   // String url="/WEB-INF/views/guestDetail.jsp";
   mav.setViewName("redirect:/list.do");
   return mav;
 } // end
コード例 #2
0
  @RequestMapping(value = "/guestEdit.do")
  public ModelAndView guestEditForm(@RequestParam("idx") int idx) {
    ModelAndView mav = new ModelAndView();
    GuestDTO dto = dao.dbDetail(idx);
    String url = "/WEB-INF/views/guestEdit.jsp";

    mav.addObject("bean", dto);
    mav.setViewName(url);
    return mav;
  } // end
コード例 #3
0
 @RequestMapping(value = "/detail.do")
 // public ModelAndView  guestDetail(@RequestParam("idx") int idx){
 public ModelAndView guestDetail(HttpServletRequest request) {
   System.out.println("\nModelAndView guestDetail(int)");
   ModelAndView mav = new ModelAndView();
   int data = Integer.parseInt(request.getParameter("idx"));
   GuestDTO bean = dao.dbDetail(data);
   System.out.println("넘어온상세 idx = " + data);
   mav.addObject("bean", bean);
   String url = "/WEB-INF/views/guestDetail.jsp";
   mav.setViewName(url);
   return mav;
 } // end
コード例 #4
0
  @RequestMapping(value = "/insert.do")
  public ModelAndView guestInsert(GuestDTO dto) {
    ModelAndView mav = new ModelAndView();
    System.out.println("\nguestInsert(GuestDTO dto)");
    System.out.println("Controller넘어온사번=" + dto.getSabun());
    System.out.println("Controller넘어온이름=" + dto.getName());
    System.out.println("Controller넘어온제목=" + dto.getTitle());
    System.out.println("Controller넘어온급여=" + dto.getPay());

    dao.dbInsert(dto);
    String url = "/WEB-INF/views/guestList.jsp";
    mav.setViewName("redirect:list.do");
    return mav;
  } // end
コード例 #5
0
  @RequestMapping(value = "/list.do")
  public ModelAndView guestList(@RequestParam(value = "pagenum", defaultValue = "1") int pagenum) {

    int countall = dao.countAll();
    //		int countall =286;
    int pageSize = 10;
    int limit = 8;
    int pageAll = 1;
    if (countall % pageSize == 0) {
      pageAll = (countall / pageSize);
    } else {
      pageAll = (countall / pageSize) + 1;
    }
    // int start = ((pagenum-1)*limit)+1;	//[2]..11~
    // int end = (pagenum*limit);			//[2]..~20
    int tmp = (pagenum - 1) % limit;
    int startPage = pagenum - tmp;
    int endPage = startPage + pageSize - 1;

    ModelAndView mav = new ModelAndView();
    System.out.println("\nModelAndView guestList()");
    List<GuestDTO> bean = dao.dbSelect(startPage, endPage);

    System.out.println("startPage : endPage :::: " + startPage + "\t" + endPage);
    System.out.println("pageAll : " + pageAll);
    // System.out.println("bean : " + bean.toString());

    mav.addObject("pagenum", pagenum);
    mav.addObject("startPage", startPage);
    mav.addObject("endPage", endPage);
    mav.addObject("pageAll", pageAll);
    mav.addObject("bean", bean);
    mav.addObject("countAll", countall);
    String url = "/WEB-INF/views/guestList.jsp";
    mav.setViewName(url);
    return mav;
  } // end
コード例 #6
0
  @RequestMapping(value = "/list2.do", method = RequestMethod.GET, consumes = "application/json")
  public @ResponseBody List<GuestDTO> guestList2(
      Model model,
      @RequestParam(value = "start", defaultValue = "1") int start,
      @RequestParam(value = "end", defaultValue = "10") int end,
      @RequestParam(value = "pagenum", defaultValue = "1") int pagenum) {
    System.out.println("list2 start end " + start + " :: " + end);

    int countall = dao.countAll();

    // int countall =286;
    int pageSize = 10;
    int limit = 8;
    int pageAll = 1;
    if (countall % pageSize == 0) {
      pageAll = (countall / pageSize);
    } else {
      pageAll = (countall / pageSize) + 1;
    }
    // int start = ((pagenum-1)*limit)+1;	//[2]..11~
    // int end = (pagenum*limit);			//[2]..~20
    int tmp = (pagenum - 1) % limit;
    int startPage = pagenum - tmp;
    int endPage = startPage + pageSize - 1;

    ModelAndView mav = new ModelAndView();
    System.out.println("\nModelAndView guestList()");
    List<GuestDTO> list = dao.dbSelect(start, end);
    System.out.println("list2 : " + list.toString());

    // model.addAttribute("countAll",countall);
    System.out.println("pageAll : " + pageAll);

    // System.out.println("bean : " + bean.toString());

    return list;
  } // end