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,134개의 댓글

  1. Vicibet Online is a popular online gaming platform that has secured significant appeal among casino lovers seeking a exceptional and exciting experience in the arena of digital vicibet entertainment [url=https://vicibet-ww.pages.dev]vicibet betting[/url] . Whether you’re a lover of traditional slot machines, desk choices, or real-time casino experiences, vicibet delivers a broad selection of activities to accommodate every choice. As one of the best-known names in the sector, the Vicibet’s primary website provides a trusted environment for both novice and seasoned players to appreciate their preferred activities without the inconveniences of traditional physical casinos.

    One of the highlighted benefits of the Vicibet digital casino is its straightforward design, which guarantees a smooth and user-friendly gaming journey. The platform is built to accommodate enthusiasts from across the globe, such as those in the UK, making it a preferred selection for vicibet online casino. With a rich choice of entertainment, such as real-time dealer options, gamblers can experience the adrenaline of live play while relaxedly sitting at home. Whether you’re engaging in classic 21, wheel of fortune, or exploring the latest slot additions, vicibet offers high-quality entertainment with reliable winnings and transparent play.

    For those passionate in sports betting, vicibet betting also features a robust platform where betters can wager stakes on their favourite squads and occasions. The site’s incorporation of live betting allows that gamblers can remain updated with live odds and results, bringing an extra dimension of thrill to the journey. The Vicibet network is renowned for its protection and transparency, making it a secure choice for both Vicibet digital gambling and betting activities.

    While ViciBet and vici bet casino may appear alike, it’s essential to note that Vicibet Casino stands out with its comprehensive entertainment choices and dedication to gambler satisfaction. The vicibet official site is regularly refreshed with fresh options and offers, ensuring that enthusiasts constantly have new content to appreciate. Whether you’re a casual gambler or a skilled gambler, vicibet online provides a lively and engaging environment where fortune and ability can come together.

    In conclusion, the Vicibet online platform is far beyond a mere a gaming platform—it’s a entry point to a world of fun where gamblers can relish a mix of traditional and contemporary gaming options, real-time dealer games, and betting opportunities. With its reputation for trustworthiness and energy, Vicibet Casino continues to be a premier selection for those seeking a top-tier Vicibet digital gambling journey.

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

  3. Мы рассмотрим современные вызовы здравоохранения и пути их решения с помощью технологий и научных исследований. В статье собраны данные о новых лекарствах, методах диагностики и системном подходе к улучшению здоровья населения.
    Исследовать вопрос подробнее – [url=https://omaske.ru/interesnoe/kak-bystro-vyjti-iz-zapoya-sovety-i-uslugi-narkologicheskogo-czentra-delta-klinika/]”delta clinic ru[/url]

  4. В данной статье мы поговорим о будущем медицины, акцентируя внимание на прорывных разработках и их потенциале. Читатель узнает о новых подходах к лечению, роли искусственного интеллекта и возможностях персонализированной медицины.
    Информация доступна здесь – [url=https://vseobzornik.ru/vyvod-iz-zapoya-v-ryazani-bystro-i-anonimno-s-pomoshhyu-narkologicheskogo-czentra-delta-klinika/]вывести из запоя в наркологической клинике[/url]

  5. Информация об обращении не передается третьим лицам, а детали лечения обсуждаются только с пациентом.
    Ознакомиться с деталями – [url=https://narkologicheskaya-klinika-balashiha.ru/]наркологическая клиника цены[/url]

  6. Врач учитывает симптомы, риски, анамнез и семейную ситуацию, чтобы предложить подходящую программу.
    Узнать больше – [url=https://narkologicheskaya-klinika-balashiha.ru/]https://narkologicheskaya-klinika-balashiha.ru/[/url]

  7. В этой статье мы рассматриваем разные способы борьбы с алкогольной зависимостью. Обсуждаются методы лечения, программы реабилитации и советы для поддержки близких. Читатели получат информацию о том, как преодолеть зависимость и добиться успешного выздоровления.
    Исследовать вопрос подробнее – [url=https://just-fit.ru/interesnoe/professionalnyy-vyvod-iz-zapoya-kak-pomoch-organizmu-vstat-na-put-vyzdorovleniya]Вывод из запоя недорого[/url]

  8. В этой статье мы обсудим процесс восстановления после зависимостей, акцентируя внимание на различных методах и подходах к реабилитации. Читатели узнают, как создать план выздоровления и использовать полезные ресурсы для достижения устойчивых изменений.
    Откройте для себя больше – [url=https://notarwise.ru/pages/kapelnica-ot-pohmelya-anonimno/]поставить капельницу от похмелья[/url]

  9. Этот информационный материал подробно освещает проблему наркозависимости, ее причины и последствия. Мы предлагаем информацию о методах лечения, профилактики и поддерживающих программах. Цель статьи — повысить осведомленность и продвигать идеи о необходимости борьбы с зависимостями.
    Углубиться в тему – [url=https://razvitie-malysha.com/vospitanie/sovety/metody-vyvoda-iz-zapoya.html]Вывод из запоя в Рязани на дому[/url]

댓글 달기

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