목록2024/07/16 (4)
wintertreey 님의 블로그
spring mvc 아키택쳐 ① 웹브라우저에게 정보요청을 받은 디스패쳐서블릿은 어느 컨트롤러에 해당 요청을 전송할지 결정 ② 디스패쳐 서블릿은 핸들러 매핑에 어느 컨트롤러를 사용할건지 물어봄. (URL로 링크)③ 결정된 컨트롤러는 해당요청을 수행하게 됨④ 해당요청을 처리한 컨트롤러는 디스패쳐서블릿에 결과를 보냄. 이 과정에서 ModelandView 가 생성된다. ⑤ ModelAndView는 실제 JSP정보를 갖고 있지 않기 때문에 ViewResolver가 실제 JSP이름으로 변환하여 해당 view를 검색함.⑥ 검색한 결과를 View에 전송⑦ View는 모든 과정에서 처리된 결과를 화면으로 표현함 ⑧ 마지막으로 디스패쳐서블릿이 웹브라우저에 최종결과를 출력. ++ 동료 HS님께서 의문을 가지셨던 Mode..
++ 환경설정 파일application.yml vs application.properties properties와 yml의 대표적인 차이는 내부 구조가 있다. properties의 경우엔 각 줄마다 key=value의 형태로 이루어져 있지만, yml의 경우엔 들여쓰기로 구분되는 계층 구조 및 key: value의 형태로 이루어져 있다. 스프링 부트가 돌아가는걸 이렇게도 확인해볼수 있다. 흐름파악하기. @어노테이션의 흐름을 파악하기 위한 실습이었다. 해당 소소파일은 sprweb5를 참고하면 된다. https://github.com/yoonah0327/spring_source GitHub - yoonah0327/spring_sourceContribute to yoonah0327/spring_sourc..
차례로 DB연동을 시도해보자. 우선 가장 전통적인 방법. 문제직급입력시, 직원목록과 인원수가 출력되게 하시오. 값을 입력받을 수 있도록 칸 생성및 get방식으로 넘겨준다. index.html 직급입력 : ListController.javapackage pack.controller;import java.util.ArrayList;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.ui.Model;import org.springframework.web.bind.annotation.GetMapping;impo..
Thymeleaf Layout Dialect를 이용하면 하나의 레이아웃을 여러 페이지에 똑같이 적용할 수 있다. 공통적으로 적용되는 레이아웃을 미리 만들어놓고 현재 작성 중인 페이지만 레이아웃을 끼워넣으면 된다.대표예시가 머릿글 바닥글이 있다. 파일의 흐름은 다음과 같다.index.html 타임리프연습. test5 하이퍼링크 >>> testcontroller.java로 이동@getmapping 작업. >>>show5.html로 이동.layout 링크 호출. header, footer.html을 다음의 위치에 만들어준다. layout1.html 머릿글 바닥글은 으로 처리해주었고, 본문은 로 설정해두었다. 머릿글, 바닥글용도. 고정. 정적. th:block은 타임리프에서 템플릿 ..