정적 웹 페이지(static web page)

정적 웹 페이지는 누군가 수동으로 변경할 때까지 동일하게 유지된다 그리고 정적사이트는 항상 모든 사람에게 동일하게 보인다.( In static web pages, Pages will remain the same until someone changes it manually. And static site will always look the same to everyone.)

 

우리가 URL(http://localhost:8080/hello-static.html)을 호출한다고 했을 때,

김영한(스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술) PDF p13

1. hello-static 관련 컨트롤러를 찾는다 ▶없다

2. hello-static.html을 찾는다.

 

동적 웹 페이지(dynamic web page)

동적 웹 사이트는 방문자에 따라 다른 정보를 제공한다. 방문자의 지역, 시간, 혹은 설정 및 선호도, 웹 사이트에서 취한 행동과 같은 여러요소에 의해 방문자의 콘텐츠가 결정될 수 있으므로 보다 맞춤화된 대화형 콘텐츠를 만들 수 있다.

(dynamic website presents different information to different visitors. The content that a visitor sees can be determined by several factors, such as their location, local time, settings and preferences, and/or actions they’re taken on the website (e.g., shopping habits), making for a more tailored and interactive experience.)

 

우리가 URL(http://localhost:8080/hello-mvc)을 호출한다고 했을 때,

김영한(스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술) PDF p14

1. hello-mvc 관련 컨트롤러를 찾는다 ▶있다.

2. ViewResolver가 hello-template.html을 찾는다.

3.hello-template.html에 model에 담긴 값을 세팅하여 보여준다.

 

** ViewResolver

스프링은 특정 뷰 기술에 얽매이지 않고 브라우저에서 모델을 렌더링할 수 있도록 ViewResolver를 제공한다. 스프링은 뷰를 처리하는 방식에 중요한 두개의 인터페이스 ViewResolver, View를 제공한다. ViewResolver는 뷰 이름과 실제 뷰 간의 매핑을 제공한다. 

(Spring provides view resolvers, which enable you to render models in a browser without tying you to a specific view technology. The two interfaces which are important to the way Spring handles views are ViewResolver and View. The ViewResolver provides a mapping between view names and actual views)

 

<bean id="viewResolver"
      class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
    <property name="prefix" value="/WEB-INF/jsp/"/>
    <property name="suffix" value=".jsp"/>
</bean>

UrlBasedViewResolver가 있다. 위와 같이 설정하면 return "test" 시 /WEB-INF/jsp/test.jsp로 보낼 RequestDispatcher 로 전달한다.

(When returning test as a viewname, this view resolver will hand the request over to the RequestDispatcher that will send the request to /WEB-INF/jsp/test.jsp.)

 

 

 

참고 ①: https://blog.hubspot.com/website/static-vs-dynamic-website

 

Static vs. Dynamic Websites: Here's the Difference

Learn the difference between static and dynamic websites, so you can decide which approach is best for your scaling business.

blog.hubspot.com

참고 ②: 김영한(스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술)

참고 ③: https://docs.spring.io/spring-framework/docs/3.0.0.M3/reference/html/ch16s05.html

'Java > Spring' 카테고리의 다른 글

[Spring] Singleton  (0) 2023.02.03
[Spring] IOC  (0) 2023.01.26
[Spring] DI  (0) 2023.01.23
[Spring] Thymeleaf Layout Dialect 설정  (0) 2022.09.27
[Spring] 반복되는 코드 Lombok으로 줄여보기  (0) 2019.08.03

+ Recent posts