SpringBoot으로 웹 출시까지 #4

springboot logo

4. thymeleaf를 이용해 레이아웃 만들기

1 myhome 만들기

https://start.spring.io/

 

project : maven

springboot :  최대한 낮은 버전 / SNAPSHOT X로 선택

group : godcoder

artifact, name : myhome

java: 8

dependencies : Thymeleaf / Spring Web / Spring Boot DevTools / Lombok

2 IntelliJ와 git 연동하기

https://github.com/

깃허브 계정이 없으신분들은 회원가입을 진행합니다.

그 뒤 강의 내용대로 진행하시면 됩니다.

저는 이번 클론 코딩을 진행하는 모든 코드를 한 번에 관리하기 위해 강의와 다르게 연동하였습니다.

git repository 생성 및 로컬 폴더 연결

을 누르시면 모든 프로젝트를 하나의 리포지토리로 관리 하실 수 있습니다.

3 bootstrap 적용

부트스트랩 스타터 탬플릿 적용

https://getbootstrap.kr/docs/5.0/getting-started/introduction/

– 강의 시점과 시간이 달라 버전이 업그레이드 되었습니다.

    코드가 달라지고, 명령어가 수정되었습니다.

    최대한 유사한 코드를 사용해서 작성했습니다.

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

    <title>Hello, world!</title>
  </head>
  <body>
    <h1>Hello, world!</h1>

    <!-- Optional JavaScript; choose one of the two! -->

    <!-- Option 1: Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>

    <!-- Option 2: Separate Popper and Bootstrap JS -->
    <!--
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
    -->
  </body>
</html>

Visual Studio Code 연결

컴퓨터에 자동 설치된 비주얼스튜디오를 실행시켜 프로젝트 파일(myhome – main – resources)을 열어줍니다.

template 폴더 아래 “index.html” 파일을 만들고 복사한 내용을 붙여넣습니다.

<html lang=“en”> -> <html>으로 수정합니다.

[intelliJ] HomeController 만들기

myhome 아래 “controller” 폴더를 생성하고,  “HomeController” 클래스를 작성합니다.

package com.godcoder.myhome.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class HomeController {
@GetMapping
public String index(){
return "index";
}
}

[VSCode]starter-template.css 작성

myhome – src – main – resources – static 아래 “starter-template.css” 파일을 생성합니다.

body {
padding-top: 5rem;
}
.starter-template {
padding: 3rem 1.5rem;
text-align: center;
}

“SpringBoot으로 웹 출시까지 #4”의 92,003개의 댓글

  1. Вывод из запоя в Воронеже требуется, когда длительное употребление алкоголя ухудшает самочувствие и пациенту нужна помощь нарколога. Лечение можно начать дома: нарколог приезжает по указанному адресу, осматривает пациента, уточняет продолжительность запоя и подбирает подходящий метод. Если состояние позволяет остаться дома, назначается лечение на месте. При повышенном риске осложнений нарколог рекомендует лечение в клинике.
    Подробнее – [url=https://vivod-iz-zapoya-voronezh17.ru/]вывод из запоя капельница[/url]

  2. Когда запой затягивается. Кто-то боится больниц. Стационар нарколог на дом — И выводит человека из этого состояния. Потом давление выравнивают. Выезд нарколога на дом Воронеж — работает и ночью. Вся информация доступна здесь: нарколог на дому капельница цена [url=https://stacionar.narkolog-na-dom-vrn-xwh.ru]нарколог на дому капельница цена[/url] И про срочный выезд для Черноземья. Не ждите, пока станет хуже.

  3. Если пациент страдает алкоголизмом несколько лет, врачу особенно важно знать историю заболевания. Нарколог уточняет прежние способы лечения, проведенное кодирование и реакцию на препараты. Новая консультация позволяет определить, подходит ли капельница и можно ли проводить лечение дома.
    Узнать больше – https://vivod-iz-zapoya-voronezh18.ru/

  4. В этой заметке мы представляем шаги, которые помогут в процессе преодоления зависимостей. Рассматриваются стратегии поддержки и чек-листы для тех, кто хочет сделать первый шаг к выздоровлению. Наша цель — вдохновить читателей на положительные изменения и поддержать их в трудных моментах.
    Нажмите, чтобы узнать больше – [url=https://www.womenpretty.ru/kak-bystro-poluchit-pomoshh-pri-tjazhjolom-pohmele-i-zapoe-prostoe-objasnenie-dlja-kazhdogo.html]наркологическая клиника дельта в краснодаре[/url]

  5. Когда нужна не только аналитика, но и рост видимости, AIMonitor даёт полный контур: глубина метрик, управляемый конкурентный анализ и слой действия. Это наиболее полное решение из трёх рассмотренных. AIMonitor с хорошим движком под капотом

  6. Некоторые симптомы требуют особенно внимательной оценки. При потере сознания, судорогах, выраженном расстройстве дыхания, психозе или тяжелом отравлении может понадобиться бригада экстренной помощи. Нарколог на дом предназначен для тех случаев, где врач может безопасно выполнить осмотр и лечение дома. При высоком риске пациент направляется в клинику.
    Подробнее – [url=https://narcolog-na-dom-voronezh017.ru/]нарколог на дом вывод в Воронеже[/url]

  7. Voici le texte converti en spintax:

    Voici un article approfondi et ameliore pour le positionnement web en francais sur le site Velobet [url=https://velo-bet-7.vercel.app]casino en ligne Velobet[/url] .

    Velobet s’impose comme l’une des plateformes de casino et de mises en ligne tres populaires aupres des joueurs francais, notamment en Hexagone. Que vous cherchiez a la recherche d’un casino en ligne fiable, d’un plateforme de betting efficace ou d’un retour honnete sur Velobet, cette alternative justifie une analyse approfondie. Avec une plateforme simple et une diversifiee offre de activites, Velobet Casino propose une sejour de jeu richissante, allant des slots aux paris en table, en passant par les betting sportif. Pour ceux qui souhaitent un avis complet sur Velobet, il est indispensable de souligner que la solution met l’accent sur la protection, la clarte et la vitesse des paiements, des elements souvent cites comme des atouts majeurs.

    Velobet Betting se demarquent egalement par sa facilite d’utilisation, ciblant aussi bien les debutants que les clients aguerris. Que vous cherchiez a la recherche d’un site de jeux en ligne Velobet ou d’un site de paris sportifs, Velobet offre des options optimisees a tous les besoins. Les clients en France peuvent decouvrir d’une plateforme accessible depuis leur appareil, sans telechargement necessaire, ce qui optimise considerablement l’ouverture aux jeux. Un retour Velobet bien documente met en avant egalement la diversite des avantages et promotions disponibles, comme les depots gratuits, qui apportent une plus-value superieure a l’sejour de jeu.

    Pour ceux qui remettent en question encore entre Velobet et d’autres sites comme Velobet Competiteur, il est essentiel de mettre en avant que Velobet Casino se consolide comme une reference en matiere de fiabilite et de controle. Les joueurs en recherche d’un site de jeux en ligne pour francophones peuvent ainsi decouvrir une solution optimisee, avec des options de transaction fiables et un support assistance efficace. Que vous cherchiez un retour Velobet exhaustif ou simplement des informations sur Velobet fr, cette plateforme comble aux attentes des clients hexagonaux en matiere de jeux et de securite.

    En synthese, Velobet Casino se offrent comme des solutions parfaites pour les amateurs de activites en ligne, combinant accessibilite, diversite et confiance. Que vous recherchiez a la recherche d’un casino en ligne sur ou d’un retour detaille sur Velobet, cette solution offre une sejour de jeu satisfaisante, ideal pour les clients de langue francaise.

댓글 달기

이메일 주소는 공개되지 않습니다.