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”의 79,944개의 댓글

  1. В этой статье мы рассматриваем разрушительное влияние зависимости на жизнь человека. Обсуждаются аспекты, такие как здоровье, отношения и профессиональные достижения. Читатели узнают о необходимости обращения за помощью и о путях к восстановлению.
    Давай разберёмся досконально – [url=https://watertechology.ru/pages/vyzvat-narkologa-na-dom-anonimno-nizhnij-novgorod/]вызвать нарколога на дом недорого[/url]

  2. В этой статье обсуждаются актуальные медицинские вопросы, которые волнуют общество. Мы обращаем внимание на проблемы, касающиеся здравоохранения и лечения, а также на новшества в области медицины. Читатели будут осведомлены о последних событиях и смогут следить за тенденциями в медицине.
    Получить больше информации – [url=https://ozon-mir.ru/pages/kapelnica-ot-zapoya-srochno/]прокапаться от алкоголя цена[/url]

  3. L’univers des loisirs digital en ligne n’arrete jamais de se transformer, et parmi les toutes dernieres applications qui retiennent le regard des parieurs, spinogambino se revele comme une destination essentiel [url=https://spino-gambinobet.fr]spinogambino fr[/url] . Si vous cherchez un espace complet combinant une selection ludique riche et des alternatives de pronostics, le site spinogambino fr semble satisfaire a vos exigences. Grace a une interface simple et une navigation agreable, le casino spinogambino permet aux inscrits de basculer simplement d’un slot captivante a un evenement sportif live.

    En parcourant un spinogambino avis, on s’apercoit rapidement que les habitues apprecient le large choix des options presentes. Que vous soyez un amateur des jeux de hasard ou que vous preferiez explorer les opportunites offertes par le bookmaker, la plateforme fournit des services ajustes a tous les types. La notoriete de ce site s’appuie sur son talent a procurer une experience protegee et variee. Par ailleurs, chaque spinogambino casino avis souligne regulierement le haut niveau des titres mis en ligne, issus de studios celebres, ainsi que la promptitude du support.

    La partie casino en ligne spinogambino est particulierement valorise pour ses designs travailles et ses probabilites de gain attractifs. Pour ceux qui sont curieux du site, la section dediee aux pronostics offre le loisir de parier sur une foule de disciplines mondiales, augmentant ainsi la seduction general du site. En examinant avec soin les prestations presentes, il est clair que le portail parie sur la flexibilite. Si vous hesitez actuellement, la lecture d’un avis spinogambino recent vous offrira une perspective transparent des benefices offerts. En resume, le casino spinogambino s’etablit comme un operateur solide pour les passionnes de mises a la recherche de fiabilite. Que ce soit pour le spinogambino betting ou afin d’explorer les additions de la selection, le site donne un espace de jeu total et excitant qui vaut la peine d’etre decouvert par la communaute francophone en quete de emotions inedites. [url=https://boimoe.com/index.php?blogger_id=2&route=information%2Fblogger]Le retour d’experience complet sur spinogambino: le nouveau site de jeux pour vos mises cette annee![/url] [url=https://ebook.jsd.or.kr/bbs/board.php?bo_table=notice&wr_id=39804]L’avis global sur l[/url] c98001e

  4. needforslotsbonus-smeargo

    At NeedForSlots, we are proud to be a premier hub for players who are enthusiastic regarding the world of digital entertainment and casino bonuses [url=https://needforslotsbonus.net/our-company]need for slots[/url] . Our brand was established on the fundamental principle that every player deserves transparent information, unbiased evaluations, and access to the best promotional offers available in the online betting industry. By visiting our website, you acquire a resource dedicated to improving your gaming experience through expert analysis and expert recommendations.

    The vision behind NeedForSlots is simple but ambitious. We aim to bridge the gap between intricate promotion rules and the users who seek to utilize them. We understand that the online casino industry can be confusing, with numerous websites vying for your attention. That is why the demand for slots expertise is at the core of everything we do. Our staff spends a lot of time evaluating platforms, checking wagering requirements, and ensuring that the rewards we feature are both lucrative and easy to claim.

    Integrity is the cornerstone of our company culture. We maintain that a great customer journey is rooted in reliability, which is why we maintain strict standards when reviewing any gaming operator. When you engage with NeedForSlots, you are interacting with a group of professionals who value your happiness and safety above all else. We offer the essential resources required to explore the betting scene with confidence, ensuring you know where the best deals are hidden.

    As we expand, our dedication stays consistent. We are regularly updating our listings to reflect the newest market shifts and the most lucrative incentives currently hitting the market. Regardless of if you are a beginner searching for extra spins or a seasoned gamer looking for large bonus funds, our company is ready to assist you maximize your time. Check out our platform today and discover why we are leading the way for excellence in the online slots community.

  5. В этой публикации мы исследуем ключевые аспекты здоровья, включая влияние образа жизни на благополучие. Читатели узнают о важности правильного питания, физической активности и психического здоровья. Мы предоставим практические советы и рекомендации для поддержания здоровья и развития профилактических подходов.
    Нажми и узнай всё – [url=https://juripedia.ru/pages/narkolog-na-dom-v-nizhnem-novgorode/]врач нарколог на дом круглосуточно нижний новгород[/url]

  6. В этом исследовании рассмотрены методы лечения зависимостей и их эффективность. Мы проанализируем различные подходы, используемые в реабилитационных центрах, и представим данные о результативности программ. Читатели получат надежные и научно обоснованные сведения о данной проблеме.
    Более подробно об этом – [url=https://fixbuilders.ru/pages/kruglosutochnyj-stacionar-vyvedenie-iz-zapoya/]вывод из запоя москва стационар[/url]

댓글 달기

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