Framework

Spring jsp 파일에서 css 파일 불러오기 / css background 입력이 안됄때

유호야 2021. 1. 14. 00:48
반응형

micropilot.tistory.com/2628

 

Static Resources in Spring

Spring 에서 정적(static) 파일 설정하기 개요 Spring 을 사용하면서 서버에서 선행처리할 필요가  없는 정적 리소스 파일은 (xml, html, js, css, jpg, gif) 웹브라우저를 통해 직접 접속할 수 있도록 해야.

micropilot.tistory.com

 

1. 첫번째 방법

servlet-context.xml 에 설정하기

<resources mapping="/resources/**" location="/resources/" />

또는 

반응형

2. 두 번째 방법

jsp 파일 안에 <head> </head> 사이에 입력

<link href="${pageContext.request.contextPath}/resources/others/other.css" rel="stylesheet">

 

3. 세번째 방법

실제 css 파일 /  img 파일 상대경로 ../ 상위폴더

* background image 경로 설정 주의

@charset "utf-8";

	.text_non_deco {
		text-decoration : none;
	}
	.text_color {
		color : black;
	}
	.text_align_center {
		text-align : center; 
	}
	
	body {
		background-size: 100%;
		background-image: url("../image/background.png");
		
	}

 

반응형