Spring

SPRING 삭제 기능 순서 흐름

piern 2018. 12. 14. 04:29

1. BoardDAO.java : 인터페이스

public void delete(Integer bno) throws Exception;


2. mapper

<delete id="delete" parameterType="hashmap">

DELETE FROM tbl_board where bno = #{bno}

</delete>


3. BoardDAOImpl.java

@Override

  public void delete(Integer bno) throws Exception {

    session.delete(namespace + ".delete", bno);

  }


4. BoardService.java : 인터페이스

public void remove(Integer bno) throws Exception;


5. BoardServiceImpl.java

@Override

  public void remove(Integer bno) throws Exception {

    dao.delete(bno);

  }


6. BoardController.java

@RequestMapping(value = "/remove", method = RequestMethod.POST)

  public String remove(@RequestParam("bno") int bno, RedirectAttributes rttr) throws Exception {


    service.remove(bno);


    rttr.addFlashAttribute("msg", "SUCCESS");


    return "redirect:/board/listAll";

  }