-
servlet-context (controller 작동 방식)Spring 2023. 3. 27. 15:12
스프링의 동작 방식
- <resources mapping="/resources/**" location="/resources/" />은 /resources/** 패턴과 일치하는 리소스에 대한 HTTP GET 요청을 처리하고, 웹 애플리케이션의 루트 디렉토리 아래 /resources/ 디렉토리에 있는 정적 리소스를 제공합니다
이 것은 효율적으로 처리되며 서버 부하를 줄이고 성능을 향상시키는 데 도움이 된다.
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">은 Spring 컨트롤러에서 렌더링을 위해 선택된 뷰를 웹 애플리케이션의 /WEB-INF/views/ 디렉토리에 있는 JSP 리소스로 해결하기 위한 뷰 리졸버를 설정합니다. 이를 통해 JSP 파일을 보안 상태로 유지하고 컨트롤러 메서드를 통해서만 접근할 수 있도록 합니다.
prefix 속성은 뷰 이름의 접두사를 설정하고, suffix 속성은 뷰 이름의 접미사를 설정합니다. 이 두 속성을 함께 사용하여 렌더링에 사용할 완전한 JSP 뷰 이름을 정의합니다.
- RequestMapping 을 이용해서 이동하고자 하는 경로로 이동해야한다.
'Spring' 카테고리의 다른 글
프로젝트의 구조 (0) 2023.03.29 기본 Spring 프로젝트 둘러보기 (0) 2023.03.28 MVC 구조 이해 (0) 2023.03.28 Spring (in eclips) jar 파일 에러 발생 시 (0) 2023.03.27 eclips 에서 Spring 다운로드 / 실행 (0) 2023.03.27