이전 서블릿

⇒ webContent에 리소스가 있기 때문에 외부에서 접근 제한이 없음

webContent
       - WEB-INF
       - *.jsp
       - image
              - *.png
       - css
              - *.css
       - js
              - *.js

 

 


 

 

스프링

⇒ WEB-INF에 리소스가 있기 때문에 외부에서 접근 할 수 없다. (보안)

webapp
      - WEB-INF
             - image
                     - *.png
             - css
                     - *.css
             - js
                     - *.js
             - views
                     - *.jsp

⇒ JSP에서 리소스(image, css, js)에 접근할 수 있도록 추가 설정이 필요하다.

⇒ servlet-context.xml에 설정

<mvc:resources location=”실제저장경로” mapping=”jsp에서 사용할 맵핑값” />

 

 


 

 

https://docs.spring.io/spring-framework/docs/5.2.25.RELEASE/spring-framework-reference/web.html#mvc-config-static-resources

 

Web on Servlet Stack

Spring Web MVC is the original web framework built on the Servlet API and has been included in the Spring Framework from the very beginning. The formal name, “Spring Web MVC,” comes from the name of its source module (spring-webmvc), but it is more com

docs.spring.io

 

 

 

 

 

Image 파일 추가

 

 

 

 

 

 

 


 

 

기존 방법 ⇒ 스프링에서는 적용안됨


 

 


 

 

스프링 방식


 

 

 


 

 

 

JS파일 추가


 

 

 


 

 

 

CSS파일 추가


'Framework > SPRING FRAMEWORK' 카테고리의 다른 글

MyBatis 연동 - 트랜잭션 처리  (0) 2023.09.18
Spring MVC + Mybatis 연동  (0) 2023.09.18
Interceptor (가로채기)  (0) 2023.09.18
로그아웃 (로그인체크확인)  (0) 2023.09.18
로그인 처리  (0) 2023.09.18
xoo | 수진