diff --git a/src/main/java/egovframework/example/sample/web/EgovSampleController.java b/src/main/java/egovframework/example/sample/web/EgovSampleController.java index f07517a..c318d52 100644 --- a/src/main/java/egovframework/example/sample/web/EgovSampleController.java +++ b/src/main/java/egovframework/example/sample/web/EgovSampleController.java @@ -60,6 +60,10 @@ public String list(@ModelAttribute SampleVO sampleVO, Model model) throws Except public String detail(@ModelAttribute SampleVO sampleVO, @RequestParam String id, Model model) throws Exception { sampleVO.setId(id); SampleVO detail = this.sampleService.selectSample(sampleVO); + + // 현재 페이지 지정 + detail.setPageIndex(sampleVO.getPageIndex()); + model.addAttribute("sampleVO", detail); return "egovSampleRegister"; } @@ -79,12 +83,12 @@ public String add(@Valid @ModelAttribute SampleVO sampleVO, BindingResult bindin } @PostMapping("/sample/update") - public String update(@Valid @ModelAttribute SampleVO sampleVO, BindingResult bindingResult) throws Exception { + public String update(@Valid @ModelAttribute SampleVO sampleVO, BindingResult bindingResult, Model model) throws Exception { if (bindingResult.hasErrors()) { return "egovSampleRegister"; } this.sampleService.updateSample(sampleVO); - return "redirect:/"; + return this.list(sampleVO, model); } @PostMapping("/sample/delete") diff --git a/src/main/resources/templates/thymeleaf/egovSampleList.html b/src/main/resources/templates/thymeleaf/egovSampleList.html index b06acad..b4cfda9 100644 --- a/src/main/resources/templates/thymeleaf/egovSampleList.html +++ b/src/main/resources/templates/thymeleaf/egovSampleList.html @@ -51,7 +51,7 @@ } function sampleCreate() { - $(location).attr('href', contextPath + '/sample/add'); + $(location).attr('href', contextPath + '/sample/add?pageIndex=[[${sampleVO.getPageIndex()}]]'); } function sampleDetail(id) { @@ -77,6 +77,7 @@
+
@@ -85,13 +86,13 @@
  • - +
  • @@ -108,6 +109,11 @@
    +
    + 총건수 : [[${paginationInfo.getTotalRecordCount()}]] + 페이지 : [[${paginationInfo.getCurrentPageNo()}]]/[[${paginationInfo.getTotalPageCount()}]] +
    + diff --git a/src/main/resources/templates/thymeleaf/egovSampleRegister.html b/src/main/resources/templates/thymeleaf/egovSampleRegister.html index 4e12e8c..fe93413 100644 --- a/src/main/resources/templates/thymeleaf/egovSampleRegister.html +++ b/src/main/resources/templates/thymeleaf/egovSampleRegister.html @@ -18,7 +18,7 @@ var contextPath = $('#contextPathHolder').attr('data-contextPath') ? $('#contextPathHolder').attr('data-contextPath') : ''; function sampleList() { - $(location).attr('href', contextPath + '/'); + $('#detailForm').attr('method', 'post').attr('action', contextPath + '/sample/list').submit(); } function sampleAdd() { @@ -64,6 +64,7 @@ +
    @@ -84,7 +85,7 @@
    카테고리ID, 카테고리명, 사용여부, Description, 등록자 표시하는 테이블
    + th:value="${sampleVO.name}" maxlength="30" style="width:300px" class="txt"/> Name Error