fix(sample): 글 등록 후 목록으로 돌아올 때 검색 조건이 풀리는 문제 수정 - #47
Merged
jei007 merged 1 commit intoSep 3, 2026
Merged
Conversation
jei007
approved these changes
Sep 3, 2026
jei007
left a comment
Contributor
There was a problem hiding this comment.
표준프레임워크에 대한 지속적인 참여에
대단히 감사드립니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
수정 사유 Reason for modification
소스를 수정한 사유가 무엇인지 체크해 주세요. Please check the reason you modified the source. ([X] X는 대문자여야 합니다.)
수정된 소스 내용 Modified source
검토자를 위해 수정된 소스 내용을 설명해 주세요. Please describe the modified source for reviewers.
문제
addSample은redirect:/egovSampleList.do로 끝나면서 목록 상태를 하나도 붙이지 않습니다. 같은 컨트롤러의updateSample과deleteSample은redirectAttributes로searchConditionsearchKeywordpageIndex를 붙여 보냅니다.값이 없어서가 아닙니다. 등록 화면
egovSampleRegister.jsp는 세 값을 히든 필드로 조건 없이 실어 보내므로addSample의sampleVO에도 그대로 들어와 있습니다. 받아 놓고 쓰지 않습니다.그래서 검색 결과에서 글을 등록하면 검색 조건이 풀린 전체 목록으로 돌아옵니다.
mvn package로 만든 WAR 를tomcat:10.1-jdk17-temurin에 올려 받은 값입니다.의도한 제거가 아니라 v5.0.0 의 누락으로 보입니다
fc0f784이전에는 세 핸들러가 모두 같은 세 줄을 갖고 있었습니다.fc0f784는updateSample과deleteSample에서 이 세 줄을redirectAttributes.addAttribute(...)로 바꿨고,addSample에서는 지우기만 하고 대신 넣지 않았습니다. 같은 커밋의 같은 파일 안에서 갈렸고, 그 커밋이addSample의 시그니처도 함께 다시 썼습니다.수정
updateSample의 파라미터 순서와 본문 배치를 그대로 따랐습니다.검증 오류로 등록 화면을 다시 그리는 경로(
bindingResult.hasErrors())는 그대로 두었습니다.#45 와의 관계
지금 브라우저에서 목록 화면을 거쳐 등록으로 넘어오는
pageIndex는 언제나1입니다.egovSampleList.jsp의 히든pageIndex가 상수1이기 때문입니다.그래서 이 수정으로 지금 당장 되살아나는 것은 검색 조건과 검색어이고, 페이지 번호는 그 히든 필드가 고쳐진 뒤에 의미가 생깁니다. 그 한 줄은 #45 로 따로 올렸습니다. 두 PR 은 파일이 겹치지 않아 순서에 상관없이 반영하실 수 있습니다.
JUnit 테스트 JUnit tests
테스트를 완료하셨으면 다음 항목에 [대문자X]로 표시해 주세요. When you're done testing, check the following items.
EgovSampleControllerAddSampleRedirectTest를 함께 넣었습니다. 같은 값을 담은SampleVO로updateSample과addSample을 호출해 돌려준 뷰 이름과RedirectAttributes를 비교합니다. 문자열 대조가 아니라 실제 호출 결과 비교입니다.수정 전 실패 메시지입니다.
수정 후에는 통과합니다.
pom.xml의 surefireskipTests가true로 고정돼 있어 그대로는 실행되지 않으니, 확인하실 때 그 값만 내려 주십시오.저장소의 스프링 통합 테스트
EgovSampleControllerTestAddSampleTest는 현재 main 에서도HV000183(EL 의존성) 으로 뜨지 않아, 이 검증은 컨트롤러 단위로 짰습니다.컨트롤러 변경만 남기는 편을 선호하시면 테스트는 빼겠습니다.
테스트 브라우저 Test Browser
테스트를 진행한 브라우저를 선택해 주세요. Please select the browser(s) you ran the test on. (다중 선택 가능 you can select multiple) [X] X는 대문자여야 합니다.
브라우저 대신 세션 쿠키를 유지하는 명령행 HTTP 클라이언트로 확인했습니다.
테스트 스크린샷 또는 캡처 영상 Test screenshots or captured video
테스트 전과 후의 스크린샷 또는 캡처 영상을 이곳에 첨부해 주세요. Please attach screenshots or video captures of your before and after tests here.
스크린샷 대신 수정 후에 받은 값을 옮깁니다. 컨테이너를 새로 띄운 직후의 초기 데이터에서 위와 같은 순서로 요청했습니다.
세 액션의
Location이 같아집니다.