Skip to content

fix(sample): 목록 화면 히든 pageIndex 하드코딩 수정(글 조회 후 페이지 위치 복원) - #45

Merged
jei007 merged 1 commit into
eGovFramework:mainfrom
wantaekchoi:fix/sample-list-pageindex-roundtrip
Sep 3, 2026
Merged

jei007 merged 1 commit into
eGovFramework:mainfrom
wantaekchoi:fix/sample-list-pageindex-roundtrip

Conversation

@wantaekchoi

Copy link
Copy Markdown
Contributor

수정 사유 Reason for modification

소스를 수정한 사유가 무엇인지 체크해 주세요. Please check the reason you modified the source. ([X] X는 대문자여야 합니다.)

  • 버그수정 Bug fixes
  • 기능개선 Enhancements
  • 기능추가 Adding features
  • 기타 Others

수정된 소스 내용 Modified source

검토자를 위해 수정된 소스 내용을 설명해 주세요. Please describe the modified source for reviewers.

문제

egovSampleList.jsp 의 listForm 히든 pageIndex 가 상수 1 을 내보냅니다.

<input type="hidden" id="pageIndex" name="pageIndex" value="1" />

목록 3페이지에서 글을 열고 목록으로 돌아오면 항상 1페이지가 나옵니다.

EgovSampleController 는 pageIndex 를 세 경로에서 모두 되돌려 줍니다. updateSampleView 는 detail.setPageIndex(sampleVO.getPageIndex()) 로, updateSample 과 deleteSample 은 redirectAttributes.addAttribute("pageIndex", ...) 로 되돌립니다. 화면이 그 값을 받지 않아 왕복이 끊깁니다.

같은 화면 안에서도 어긋납니다. 같은 폼의 searchCondition 과 searchKeyword 는 ${sampleVO...} 로 복원하는데 pageIndex 만 상수이고, 같은 응답의 No 컬럼은 ${sampleVO.pageIndex} 로 3페이지 번호를 그리는데 히든 필드는 1 을 내보냅니다.

fc0f784(v5.0.0, KRDS 디자인 적용) 에서 <form:hidden path="pageIndex" /> 가 지금의 상수 입력으로 바뀌었습니다. 같은 커밋이 <form:select path="searchCondition"> 과 <form:input path="searchKeyword"> 는 수동 태그에 ${sampleVO...} 를 붙여 복원을 유지했고, updateSampleView 의 set... 호출과 redirectAttributes 전환도 이 커밋에서 들어왔습니다. 왕복을 새로 세우면서 목록 화면만 복원식을 받지 못한 것으로 보입니다.

수정

히든 필드 한 줄을 같은 폼의 다른 필드 및 egovSampleRegister.jsp 와 동일한 형태로 맞췄습니다.

-<input type="hidden" id="pageIndex" name="pageIndex" value="1" />
+<input type="hidden" id="pageIndex" name="pageIndex" value="${sampleVO.pageIndex}" />

페이지 링크는 fn_egov_link_page 가 제출 직전에 이 히든 값을 덮어쓰므로 영향이 없습니다.

알려진 부수효과

이 수정 뒤에는 3페이지에서 검색하면 pageIndex=3 이 함께 전송되어, 결과가 3페이지에 못 미치면 빈 목록이 나옵니다.

?searchCondition=0&searchKeyword=SAMPLE-0011&pageIndex=1 → 5건
?searchCondition=0&searchKeyword=SAMPLE-0011&pageIndex=3 → 0건, No Data Found

지금은 히든이 상수라 검색이 늘 1페이지로 리셋됩니다. 다만 그 리셋은 fc0f784 이전에는 없던 동작입니다. 부모 커밋 b24dc50 의 같은 JSP 도 <form:hidden path="pageIndex" /> 로 페이지를 유지하고 fn_egov_selectList 에 리셋이 없으며, egovframe-hands-on-guide 의 lab14-1 실습 소스도 같습니다.

검색 시 1페이지로 되돌리는 편이 낫다고 보시면 fn_egov_selectList() 에 document.listForm.pageIndex.value = 1; 한 줄을 더하면 됩니다. 이번 수정이 다루는 왕복 문제와는 별개 결정이라 넣지 않았습니다. 함께 반영하는 편이 좋겠다고 하시면 이 PR 에 추가하겠습니다.

EgovSampleListJspPageIndexTest 도 함께 넣었습니다. 히든 필드 한 줄만 남기는 편을 선호하시면 빼겠습니다.

JUnit 테스트 JUnit tests

테스트를 완료하셨으면 다음 항목에 [대문자X]로 표시해 주세요. When you're done testing, check the following items.

  • JUnit 테스트 JUnit tests
  • 수동 테스트 Manual testing

EgovSampleListJspPageIndexTest 는 수정 전에는 실패하고 수정 후에는 통과합니다. 같은 실행에서 EgovSampleControllerTestAddSampleTest 가 Failed to load ApplicationContext (activeProfiles = ["mysql", "dummy"]) 로 오류를 내는데, 이 수정과 무관하게 현재 main 에서도 동일하게 발생하는 선행 오류입니다.

테스트 브라우저 Test Browser

테스트를 진행한 브라우저를 선택해 주세요. Please select the browser(s) you ran the test on. (다중 선택 가능 you can select multiple) [X] X는 대문자여야 합니다.

  • Chrome
  • Firefox
  • Edge
  • Safari
  • Opera
  • Internet Explorer
  • 기타 Others

브라우저 대신 세션 쿠키를 유지하는 명령행 HTTP 클라이언트로 화면 왕복을 확인했습니다.

테스트 스크린샷 또는 캡처 영상 Test screenshots or captured video

테스트 전과 후의 스크린샷 또는 캡처 영상을 이곳에 첨부해 주세요. Please attach screenshots or video captures of your before and after tests here.

스크린샷 대신 실제 응답에서 뽑은 값을 옮깁니다. mvn package 로 만든 WAR 를 tomcat:10.1-jdk17-temurin 에 올려 확인했습니다.

수정 전

GET /egovSampleList.do?pageIndex=3
  listForm 히든 pageIndex = 1
  No 컬럼 = 94 ... 85, 첫 행 SAMPLE-00094
POST /updateSampleView.do 후 목록 복귀
  첫 행 = SAMPLE-00114   (1페이지)

수정 후

GET /egovSampleList.do?pageIndex=3
  listForm 히든 pageIndex = 3
  No 컬럼 = 94 ... 85, 첫 행 SAMPLE-00094
POST /updateSampleView.do 후 목록 복귀
  첫 행 = SAMPLE-00094   (3페이지 유지)
POST /updateSample.do 후 redirect ...&pageIndex=3
  첫 행 = SAMPLE-00094   (3페이지 유지)

@jei007 jei007 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

표준프레임워크에 대한 지속적인 참여에
대단히 감사드립니다.

@jei007
jei007 merged commit dd9ce17 into eGovFramework:main Sep 3, 2026
1 check passed
@wantaekchoi
wantaekchoi deleted the fix/sample-list-pageindex-roundtrip branch September 3, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants