1) Spring Boot 동적 파일 반영 (pom.xml)
<!-- 동적 파일 반영 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
2) Servlet 엔진 + jstl 연동 (pom.xml)
<!-- jsp Servlet Engine -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<!-- jstl 라이브러리 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
3) Controller 설정
@GetMapping("/main")
public String main() {
System.out.println("main====");
return "/views/common/main.jsp";
}
4) jsp 설정
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
Hello World!!
</body>
</html>
5) http://localhost:8080/main 호출
정상화면 ^^
6) application.properties
spring.mvc.view.prefix=/views/
spring.mvc.view.suffix=.jsp
7) Controller 설정
@GetMapping("/main")
public String main() {
System.out.println("main====");
//return "/views/common/main.jsp";
return "common/main";
}
8) http://localhost:8080/main 호출
정상화면 ^^
'개발 > Spring Boot' 카테고리의 다른 글
6.thymeleaf 설정 (0) | 2021.02.11 |
---|---|
5. Lombok 설정 (0) | 2021.02.11 |
4. log4j2 설정 (0) | 2021.02.07 |
2. MySql 연결 (0) | 2021.02.06 |
1.Spring Boot 환경 셋팅 (0) | 2021.02.06 |