spring boot intellij 초기 설정

0

< start.spring.io >

dependenceies
1. Spring Web
2. Thymeleaf // template engine
3. Spring boot DevTools // for LiveReload

< 인텔리제이 >

setting > build tools > Gradle
build and run using - Gradle 에서 intellij IDEA 로 변경

jsp 설정 >

  • build.gradle 에 의존성 추가 삭제
    ( thymeleaf 동시 사용 불가 )
// 삭제:
//	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'


//추가:
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'
implementation 'javax.servlet:jstl'
  • application.properties 에 jsp 경로 삽입
# 경로
spring.mvc.view.prefix= /WEB-INF/views/
spring.mvc.view.suffix= .jsp

# jsp 수정시 자동반영 - 확인 필요
server.servlet.jsp.init-parameters.development=true
  • .jsp 파일 생성
    폴더를 먼저 생성한다. main 아래부터는 직접 생성
    /src/main/webapp/WEB-INF/views/index.jsp

코드내용

<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
hello
</body>
</html>
  • jsp controller 추가
profile
이곳은 Fola Flor 의 메모 창고입니다. 깃허브, 트위터, 기술 블로그 링크가 이 문장 바로 아래에 있습니다.

0개의 댓글