일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- java
- JPQL
- Spring Boot
- Servlet
- JDBC
- AOP
- 인프런
- SpringBoot
- QueryDSL
- 스프링 핵심 원리
- springdatajpa
- 자바
- Exception
- Greedy
- 그리디
- db
- 백준
- http
- jpa
- kotlin
- Proxy
- 알고리즘
- Thymeleaf
- pointcut
- 스프링
- 스프링 핵심 기능
- transaction
- Android
- 김영한
- spring
- Today
- Total
목록th:each (3)
개발자되기 프로젝트
앞선 글에서 중첩된 th:each 에서 필드값이 조회가 안되었다. 1. th:block th:block은 동일한 thymeleaf attribute(th:if, th:each)를 적용할수있도록 한다. Coffee Name Info 즉 위와 같은 코드의 경우 coffeOptions에서꺼낸 coffee를 th:block내에서 유효하게 사용이 가능. 2. th:block, th:each th:block은 동일 block 내에서 th:each도 동일하게 적용을 해준다. 이를 이용하면 중첩된 반복문도 가능하다. 즉 block 내에서 th:each가 계속 살아있도록 해줌. Shop name 3. 코드 수정 th:block과 th:each를 같이 적용해줬다. th:block이 없으면 th:each가 중첩될 시 뒤에 ..
1. 반복 th:each 반복에서 사용할 수 있는 여러 상태 값 지원함. 2. 반복기능 th:each 반복시 오른쪽 컬렉션( ${users} )의 값을 하나씩 꺼내서 왼쪽 변수( user )에 담아서 반복. th:each 는 List 뿐만 아니라 배열, java.util.Iterable , java.util.Enumeration 을 구현한 모든 객체를 반복에 사용 가능. Map 도 사용할 수 있음. 변수에 담기는 값은 Map.Entry Key 1 Value 1 3. 현재 반복 상태 알려주는 기능. 두 번째 파라미터를 통해 반복의 상태를 확인 가능 두 번째 파라미터는 생략 가능한데 기본적으로 변수명+Stat index : 0부터 시작 count : 1부터 시작 size : 전체 사이즈 even , odd ..
1. Controller ItemRepository는 final로 선언. 그리고 Constructor를 통해 주입받음. ->lombok 이용 생성자가 딱 한개 있으면 @Autowired생략 가능. @Controller @RequestMapping("/basic/items") @RequiredArgsConstructor public class BasicItemController { private final ItemRepository itemRepository; @GetMapping public String items(Model model){ List items = itemRepository.findAll(); model.addAttribute("items", items); return "basic/item..