From 5acf0e6a9c91eb27a0c266cffb5117dcbf5bdda6 Mon Sep 17 00:00:00 2001 From: allonsky Date: Fri, 26 Sep 2025 15:23:23 +0900 Subject: [PATCH] =?UTF-8?q?1.=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=ED=99=94?= =?UTF-8?q?=EB=A9=B4=EC=97=90=EC=84=9C=20=EC=A1=B0=ED=9A=8C=EC=A1=B0?= =?UTF-8?q?=EA=B1=B4=EC=9D=98=20'Name',=20'ID'=EB=A5=BC=20'=EC=B9=B4?= =?UTF-8?q?=ED=85=8C=EA=B3=A0=EB=A6=AC=EB=AA=85',=20'=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=ACID'=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=A8.?= =?UTF-8?q?=202.=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=A1=B0=ED=9A=8C=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=EB=9E=80=EC=97=90=EC=84=9C=20=EC=97=94?= =?UTF-8?q?=ED=84=B0=EB=A1=9C=20=EC=A1=B0=ED=9A=8C=EB=90=98=EA=B2=8C=20?= =?UTF-8?q?=ED=95=A8.=203.=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=ED=99=94?= =?UTF-8?q?=EB=A9=B4=EC=97=90=EC=84=9C=20=EB=93=B1=EB=A1=9D,=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=EB=B3=B4=EA=B8=B0=20=ED=99=94=EB=A9=B4=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99=20=ED=9B=84=20=EB=8B=A4=EC=8B=9C?= =?UTF-8?q?=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=ED=99=94=EB=A9=B4=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99=20=EC=8B=9C=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=ED=96=88=EB=8D=98=20=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99=ED=95=98=EA=B2=8C=20=EB=B3=80=EA=B2=BD.=204.?= =?UTF-8?q?=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=ED=99=94=EB=A9=B4=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=B4=9D=EA=B1=B4=EC=88=98,=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80(=ED=98=84=EC=9E=AC=20=ED=8E=98=EC=9D=B4=EC=A7=80/?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=ED=8E=98=EC=9D=B4=EC=A7=80)=20=ED=91=9C?= =?UTF-8?q?=EC=B6=9C=ED=95=A8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/sample/web/EgovSampleController.java | 8 ++++++-- .../templates/thymeleaf/egovSampleList.html | 14 ++++++++++---- .../templates/thymeleaf/egovSampleRegister.html | 5 +++-- 3 files changed, 19 insertions(+), 8 deletions(-) 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