Skip to content

fix(sample): 목록 No 칼럼이 한 페이지 행수로 pageSize 를 써 번호가 어긋나는 문제 수정 - #51

Merged
jei007 merged 1 commit into
eGovFramework:mainfrom
wantaekchoi:fix/list-row-number-uses-page-size
Sep 9, 2026
Merged

jei007 merged 1 commit into
eGovFramework:mainfrom
wantaekchoi:fix/list-row-number-uses-page-size

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 의 No 칼럼이 한 페이지 행수 자리에 pageSize 를 씁니다.

<td class="text-center"><c:out value="${paginationInfo.totalRecordCount+1 - ((sampleVO.pageIndex-1) * sampleVO.pageSize + status.count)}"/></td>

같은 응답을 만든 EgovSampleController 는 한 페이지 행수를 pageUnit 으로 정합니다.

paginationInfo.setRecordCountPerPage(sampleVO.getPageUnit());
paginationInfo.setPageSize(sampleVO.getPageSize());

sampleVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
sampleVO.setLastIndex(paginationInfo.getLastRecordIndex());
sampleVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());

getFirstRecordIndex()·getLastRecordIndex() 가 recordCountPerPage 로 조회 범위를 잡고 EgovSample_Sample_SQL.xml 의 LIMIT #{recordCountPerPage} 가 그 값으로 자릅니다. pageSize 는 PaginationInfo 에서 getFirstPageNoOnPageList()·getLastPageNoOnPageList() 계산에만 쓰이는 값, 즉 페이저에 찍을 페이지 번호 개수입니다.

context-properties.xml 이 pageUnit 과 pageSize 를 둘 다 10 으로 두어 기본 설정에서는 두 식이 같은 값을 냅니다. 한쪽만 바꾸면 갈라집니다.

수정

행수 자리에 조회에 실제로 쓰인 값을 씁니다.

-${paginationInfo.totalRecordCount+1 - ((sampleVO.pageIndex-1) * sampleVO.pageSize + status.count)}
+${paginationInfo.totalRecordCount+1 - ((sampleVO.pageIndex-1) * paginationInfo.recordCountPerPage + status.count)}

EgovSampleListJspRowNumberTest 를 함께 넣었습니다. JSP 에서 이 식을 뽑아 실제 PaginationInfo·SampleDefaultVO 로 평가하는 테스트입니다. JSP 한 줄만 남기는 편을 선호하시면 빼겠습니다.

JUnit 테스트 JUnit tests

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

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

pom.xml 의 surefire 설정이 <skipTests>true</skipTests> 라 그대로 두면 실행되지 않습니다. 아래는 그 값을 false 로 두고 mvn -Ptest test 로 돌린 결과입니다. EL 구현체인 expressly 가 test 프로필에만 선언돼 있어 프로필 없이 돌리면 이 테스트가 EL provider 를 못 찾습니다.

수정 전

[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.057 s <<< FAILURE! -- in egovframework.example.sample.web.EgovSampleListJspRowNumberTest
[ERROR]   EgovSampleListJspRowNumberTest.test:101 2쪽 첫 행의 No 는 전체 건수에서 앞 쪽 행수만큼 뺀 값이어야 한다. 식=paginationInfo.totalRecordCount+1 - ((sampleVO.pageIndex-1) * sampleVO.pageSize + status.count) ==> expected: <109> but was: <104>

수정 후

[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.034 s -- in egovframework.example.sample.web.EgovSampleListJspRowNumberTest

전체 스위트는 같은 워크트리에서 이 수정만 토글해 대조했습니다. 수정 있음 Tests run: 10, Failures: 0, 수정 없음 Tests run: 10, Failures: 1 이고 그 1건이 위 테스트입니다.

테스트 브라우저 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

mvn package 로 만든 WAR 를 tomcat:10.1-jdk17-temurin 에 올리고 명령행 HTTP 클라이언트로 응답을 받았습니다.

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

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

스크린샷 대신 실제 응답에서 뽑은 No 칼럼과 ID 를 옮깁니다. context-properties.xml 의 pageUnit 만 5 로 두고 pageSize 는 10 그대로입니다(전체 114건).

              수정 전              수정 후
pageIndex=1    114 SAMPLE-00114     114 SAMPLE-00114
pageIndex=2    104 SAMPLE-00109     109 SAMPLE-00109
pageIndex=3     94 SAMPLE-00104     104 SAMPLE-00104
pageIndex=23  -106 SAMPLE-00004       4 SAMPLE-00004

기본 설정인 pageUnit 10 · pageSize 10 에서는 2쪽 첫 행이 수정 전후 모두 104 SAMPLE-00104 로 같습니다.

EgovSampleController 는 한 페이지 행수를 pageUnit 으로 정해
PaginationInfo.recordCountPerPage 에 넣고, 매퍼가 그 값으로 조회 범위를 자른다.
pageSize 는 페이저에 찍을 페이지 번호 개수라 행수가 아니다.

목록 No 칼럼이 행수 자리에 pageSize 를 쓰고 있어 두 값이 갈리는 순간부터
번호가 어긋난다. pageUnit 5·pageSize 10 이면 2쪽 첫 행이 109 대신 104 로 찍힌다.

No 칼럼의 EL 식을 실제 모델로 평가하는 테스트를 함께 넣는다.

@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 24911d3 into eGovFramework:main Sep 9, 2026
1 check passed
@wantaekchoi
wantaekchoi deleted the fix/list-row-number-uses-page-size branch September 9, 2026 08:33
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