일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 인프런
- Android
- db
- spring
- Servlet
- kotlin
- SpringBoot
- JDBC
- http
- 그리디
- Greedy
- springdatajpa
- transaction
- jpa
- JPQL
- Spring Boot
- 스프링 핵심 원리
- Thymeleaf
- QueryDSL
- 자바
- Proxy
- AOP
- Exception
- pointcut
- 스프링 핵심 기능
- 김영한
- 백준
- java
- 스프링
- 알고리즘
- Today
- Total
목록메시지 (3)
개발자되기 프로젝트
1. Spring이 직접 만든 오류 메시지 처리 검증 오류 코드는 크게 두 가지 개발자가 직접 설정한 오류 코드 -> rejectValue()를 직접 호출함 Spring이 직접 검증 오류에 추가한 경우 -> 바인딩 오류(주로 타입종류 맞지 않은 경우) 2. 동작 방식 price필드에 "A"를 입력하자. log를 보면 BindingResult에서 FieldError를 확인할 수 있다. Field error in object 'item' on field 'price': rejected value [qqq]; 또한 다음과 같이 Message Codes가 생성된다. codes[typeMismatch.item.price,typeMismatch.price,typeMismatch.java.lang.Integer,ty..
1. MessageSource Interface public interface MessageSource { String getMessage(String code, @Nullable Object[] args, @Nullable String defaultMessage, Locale locale); String getMessage(String code, @Nullable Object[] args, Locale locale) throws NoSuchMessageException; } code와 일부 파라미터로 메세지를 읽어올 수 있는 기능을 제공 2. 예시-기본 앞서 messages.properties에 아래와 같이 등록했다. 여기서 hello는 code, 안녕은 message 이다. hello=안녕 hello..
1. 메시지 기능. 화면에 보이는 문구가 마음에 들지 않는다고, 상품명이라는 단어를 모두 상품이름으로 고쳐달라고 하면 어떻게 해야할까? 여러 화면에 보이는 상품명, 가격, 수량 등, label 에 있는 단어를 변경하려면 관련있는 모든 화면들을 다 찾아가면서 변경해야 한다. addForm.html , editForm.html , item.html , items.html 귀찮다.. 이렇게 다 바꿔야 하는 이유가 뭘까? 바로 HTML 파일에 메시지가 하드코등 되어있기 때문. 메시지를 한 곳에서 관리하는 기능이 메시지 기능임. 예를들어 message.properties 와 같은 관링용 파일 생성. item=상품 item.id=상품 ID item.itemName=상품명 item.price=가격 item.quant..