fix(sample): 등록/수정 폼의 maxlength를 SAMPLE 컬럼 폭에 맞춤 - #74
Merged
jei007 merged 1 commit intoSep 9, 2026
Merged
Conversation
카테고리명은 maxlength=60인데 SAMPLE.NAME은 VARCHAR(50)이고, 등록자는 maxlength=60인데 SAMPLE.REG_USER는 VARCHAR(10)이다. 같은 폼의 설명만 DESCRIPTION VARCHAR(200)에 맞춰 maxlength=200과 '/200' 카운터를 쓴다. 한도를 넘겨 입력하면 검증 메시지 없이 INSERT까지 내려가 잘림 예외가 나고 sample/egovSampleError(500)로 떨어진다. 등록자 11자는 'size limit: 10 table: SAMPLE column: REG_USER', 카테고리명 51자는 'size limit: 50 table: SAMPLE column: NAME'이다. 컬럼 폭은 src/main/resources/db/sampledb.sql과 script/ddl 8종이 NAME 50 / DESCRIPTION 200 / REG_USER 10으로 일치한다. 등록·수정 두 화면이 렌더한 maxlength를 컬럼 폭과 대조하는 테스트를 추가한다.
jei007
approved these changes
Sep 9, 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
수정된 소스 내용 Modified source
egovSampleRegister.html은 입력 항목의maxlength를 SAMPLE 테이블 컬럼 폭에 맞추는 규칙을 스스로 지키고 있습니다. 설명은DESCRIPTION VARCHAR(200)에 맞춰maxlength="200"(122행)과/200카운터(126행)를 함께 둡니다. 그런데 카테고리명은NAME VARCHAR(50)인데maxlength="60"(100행), 등록자는REG_USER VARCHAR(10)인데maxlength="60"(136·141행) 입니다.컬럼 폭은
src/main/resources/db/sampledb.sql:3과script/ddl아래 8개 DBMS 스크립트가 모두NAME 50 / DESCRIPTION 200 / REG_USER 10으로 같습니다.SampleVO는@EgovNullCheck세 개만 선언하고 길이 검증이 없어(@Size·@Length는src/main/java전체에 없습니다) 한도를 넘긴 값이 그대로insertSample로 넘어갑니다. 그래서 화면 검증 메시지가 아니라 INSERT 단계의 잘림 예외가 나고,EgovConfigWeb의SimpleMappingExceptionResolver매핑을 타sample/egovSampleError로 떨어집니다.등록자 11자로
POST /addSample.do를 보낸 결과입니다. 응답은 status=500, view=sample/egovSampleError입니다.카테고리명 51자도 같은 자리에서
size limit: 50 table: SAMPLE column: NAME으로 떨어집니다.변경 내용
nameNAME VARCHAR(50)maxlength="60"maxlength="50"regUser(수정 화면, readonly)REG_USER VARCHAR(10)maxlength="60"maxlength="10"regUser(등록 화면)REG_USER VARCHAR(10)maxlength="60"maxlength="10"템플릿 3줄이고 설명(122행)은 이미 맞아 있어 그대로 두었습니다.
maxlength는 클라이언트 가드라 폼을 우회한 직접 요청은 여전히 500 으로 떨어집니다. 서버 측 길이 검증(@Size)은 메시지 키를message-common*.properties세 파일에 새로 넣어야 해서 이번 변경에 넣지 않았습니다. Oracle·Tibero 는VARCHAR2가 바이트 기준이라 한글 입력에서는 이 값으로도 넘칠 수 있습니다. 이번 변경은 선언된 컬럼 폭에 맞추는 데까지입니다.검증
등록 화면(
POST /addSampleView.do)과 수정 화면(POST /updateSampleView.do)이 실제로 렌더한maxlength를 컬럼 폭과 대조하는 테스트를 추가했습니다. 같은 패키지의 기존 web 테스트와 같은 MockMvc 층입니다.수정 전에는 두 메서드가 이렇게 실패합니다.
mvn test전체 결과는 수정 전수정 후
실패 2건은 추가한 테스트뿐이고 기존 54건은 두 회차 모두 통과합니다.
JUnit 테스트 JUnit tests
테스트 브라우저 Test Browser
브라우저 실행은 하지 않았습니다. 렌더된 HTML 의
maxlength는 위 테스트가 대조합니다.테스트 스크린샷 또는 캡처 영상 Test screenshots or captured video
위 출력으로 대신합니다.