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”의 81,476개의 댓글

  1. Эта доказательная статья представляет собой глубокое погружение в успехи и вызовы лечения зависимостей. Мы обращаемся к научным исследованиям и опыту специалистов, чтобы предоставить читателям надежные данные об эффективности различных методик. Изучите, что работает лучше всего, и получите информацию от экспертов.
    Обратиться к источнику – [url=https://pobetony.expert/zdorove/lechenie-alkogolizma-kodirovanie-narkologiya-24]нарко 24[/url]

  2. Если врач считает домашнее лечение небезопасным, родственникам объясняют причины и предлагают стационарное наблюдение. Такая тактика снижает риск осложнений и позволяет выполнить полную диагностику. В клинике доступен дежурный медицинский персонал, а при необходимости привлекается психиатр, проводится экспресс-оценка, ЭКГ и другие мероприятия.
    Ознакомиться с деталями – https://2.kapelnica-ot-zapoya-v-moskve14.ru/

  3. В этой статье мы рассмотрим современные достижения в области медицины, включая инновационные методы лечения и диагностики. Мы обсудим важность профилактики заболеваний и роль технологий в улучшении качества здравоохранения. Читатели узнают о влиянии медицины на повседневную жизнь и ее значение для современного общества.
    Ознакомиться с отчётом – [url=https://fixbuilders.ru/pages/chastnyj-medik-24-otzyvy/]частный медик[/url]

  4. Heya i’m for the first time here. I came across this board and
    I find It truly useful & it helped me out a lot. I hope
    to give something back and aid others like you
    aided me.

  5. Мы рассмотрим современные вызовы здравоохранения и пути их решения с помощью технологий и научных исследований. В статье собраны данные о новых лекарствах, методах диагностики и системном подходе к улучшению здоровья населения.
    Изучить материалы по теме – [url=https://drivefun.ru/pages/klinika-zavisimost-24/]наркоклиника в москве[/url]

  6. spinogambinocasino-insague

    As you navigate the platform of Spino Gambino, it is crucial to understand how your information is handled to ensure a seamless and tailored experience [url=https://spinogambinocasino-login.net/cookie-policy]spino gambino[/url] . The official cookie policy at spinogambino-login.net describes the particular methods utilized to collect information via browser cookies. These small text files are placed on your device to assist the platform recall your choices and improve site performance. By using the Spino Gambino website, you consent to the application of these cookies in alignment with the stated privacy standards.

    The primary goal of utilizing cookies on the platform is to improve user navigation. For example, when you revisit spinogambino, these files enable the site to identify your past settings, including language choices or display preferences, making your journey more productive. Moreover, the site employs analytical cookies to track site activity. This information helps the team at Spino Gambino determine which areas are most visited and where improvements might be needed to offer a better gaming experience. These insights are exclusively applied for internal optimization and are managed with high security.

    In conjunction with functional and tracking tools, some cookies may be utilized for marketing purposes. These help deliver appropriate content that aligns with your individual interests. It is vital to recognize that you have full control over your privacy settings. The majority of modern web browsers permit you to adjust your preferences to restrict or remove cookies at any time. Nevertheless, please be aware that disabling certain cookies might affect your ability to fully access all the features provided on the spinogambino-login.net portal.

    By maintaining a transparent and easy-to-read cookie policy, the platform ensures that every player stays educated regarding their data rights. If you have any particular concerns or doubts regarding how your information is handled while browsing the Spino Gambino site, you are invited to check the complete policy file on the main website. Openness is a core value, guaranteeing your time on the site remains both secure and pleasant.

  7. В статье рассматриваются различные стратегии борьбы с зависимостями, включая проверенные методы и реальные истории успеха. Читатель узнает, какие подходы наиболее эффективны и как начать путь к выздоровлению.
    Секреты успеха внутри – [url=https://pobetony.expert/zdorove/skolko-stoit-prokapatsya]капельницы от запоя[/url]

  8. Знакомая ситуация. Вот тогда и возникает мысль. Скачать 1xbet на андроид — Главное не нарваться на левый файл. Ставки делаются в пару кликов. 1xbet скачать ios — Но тоже решаемо. Советую глянуть источник: 1xbet mobile online [url=https://1xbet-skachat-xyt.com]1xbet mobile online[/url] И про мобильную версию для ставок. Не скачивайте сомнительные файлы.

댓글 달기

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