본문 바로가기

thymeleaf3

[회원 관리 예제 : 웹 MVC 개발] 홈, 회원 등록, 회원 조회 본격적으로 url 요청에 따른 Controller 들을 설정해주도록 하자. 홈 화면 추가 localhost:8080 요청 시, 홈 화면(home.html)으로 이동한다. 기존에 똑같은 매핑이 resource > static 에 index.html 로 존재했으나, @Controller 에서 Spring Container 가 먼저 매핑되는 화면을 먼저 찾기 때문에 home.html 이 우선적으로 보여진다. 회원 등록 form 태그에서 post로 "/members/new" 로 넘기고 해당 처리 메소드 create의 인자로 MemberForm 타입이 들어간다. createMemberForm에서 form 태그로 넘어온 input의 name key의 input value "spring" 을 MemberForm 의 .. 2022. 7. 1.
[스프링 웹 개발 기초 - (2)] MVC와 템플릿 엔진 hello-mvc -> helloMvc 추가 @RequestParam 으로 query string 의 name 속성을 추가하여 인자로 name 을 받아 model의 name 속성의 value 로 매핑하고, 뷰 리졸버가 template/hello-template.html 에 전달 - Thymeleaf 의 특징 : 서버가 켜져 있지 않아도 Absolute Path 로 접근하면 body tag 의 내용(hello! empty), 즉 껍데기를 볼 수 있음. 즉, Thymeleaf 엔진으로 실행하지 않은 상태이다. 서버 및 Thymeleaf 엔진으로 실행시, th:text의 내용으로 치환이 된다. - 주의 ! localhost:8080/hello-mvc 로 접근하면 Required String parameter .. 2022. 6. 29.
[프로젝트 환경설정 - (3)] View 환경설정 7.1.6 의 Welcome Page 설명을 보면, 서버가 실행되고 루트로 접속하면 먼저 resources/static 경로의 index.html 을 먼저 찾고, 없으면 resources/templates 경로의 index 탬플릿을 찾는다고 한다. https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features Core Features Spring Boot lets you externalize your configuration so that you can work with the same application code in different environments. You can use a variety of ext.. 2022. 6. 29.