티스토리 뷰
1. 프로젝트 생성
name : boot06
Dependencies : DevTools, H2, JPA, Thymeleaf, Web
2. dependency 추가
링크(클릭)에서 maven탭 코드
1
2
3
4
5
6 |
<!-- https://mvnrepository.com/artifact/nz.net.ultraq.thymeleaf/thymeleaf-layout-dialect -->
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
<version>2.3.0</version>
</dependency> |
cs |
위 코드를 pom.xml → pom.xml → <dependencies> 태그 사이에 붙여넣기
3. layout 폴더 만들기(p.257)
boot06 → src/main/resources → templates → layout 폴더 만들기
boot05\src\main\resources의 static 폴더 내용물을 boot 06 → src/main/resources/static에 붙여넣기
boot05\src\main\resources의 template 폴더 내용물을 boot 06 → src/main/resources/template에 붙여넣기 → Overwrite → layout 폴더 하나 남기고 전부 삭제
4.부트스트랩
boot06 → src/main/resources → templates → layout → layout.html 에서
<head>영역에 링크(클릭)의 부트스트랩 CDN 코드 넣기
1
2
3
4
5
6
7
8 |
<!-- 합쳐지고 최소화된 최신 CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- 부가적인 테마 -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<!-- 합쳐지고 최소화된 최신 자바스크립트 -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> |
cs |
<body> 영역에 아래 코드 넣기
1
2
3
4
5
6
7
8 |
<div class="page-header">
<h1>
Boot06 Project <small>for Spring MVC + JPA</small>
</h1>
</div>
<!-- content body -->
<div class="panel panel-default" layout:fragment="content">
</div> |
cs |
google analitics 코드 삭제
5. Controller 생성
src/main/java → com.younggeun.board → BoardController 클래스 만들기
*BoardController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14 |
package com.younggeun.board;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/boards/")
public class BoardController {
@GetMapping("/list")
public void list() {
System.out.println("called list()");
}
} |
cs |
6. list.html 만들기
boot06 → src/main/resources → templates → boards폴더 생성 → list.html 파일 생성
*list.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 |
<html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{/layout/layout1}">
<div layout:fragment="content">
<div class="panel-heading">List Page</div>
<div class="panel-body">
list content
</div>
</div>
<th:block layout:fragment="script">
<script th:inline="javascript">
</script>
</th:block> |
cs |
'웹 > SpringBoot,게시판 만들기' 카테고리의 다른 글
[SpringBoot]5/29 (0) | 2018.06.01 |
---|---|
[SpringBoot]5/15 (2) | 2018.05.24 |
[SpringBoot]MySQL 설치 및 테스트 (2) | 2018.04.27 |
[SpringBoot]스프링부트 프로젝트 생성하기 (0) | 2018.04.27 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 백준 11501
- 파이썬 if문
- 백준 10451
- css 그리드
- 파이썬 객체
- 파이썬 선택문
- 파이썬 진수 변환
- 파이썬 단계적 개선
- 자료구조
- 파이썬 예제
- 파이썬
- 자바 에센셜 실습문제
- 파이썬 클래스
- 파이썬 연산자
- 웹
- 파이썬 문자열
- 파이썬 for
- 파이썬 함수
- css 박스
- 파이썬 리스트
- css
- 백준
- 자바스크립트 자료구조
- 백준 1874
- 자바스크립트 그래프
- 명품 c++ 실습
- 파이썬 while
- 파이썬 터틀
- 버츄어박스
- 자바
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함