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

  1. Состояние пациента отслеживается на каждом этапе, от первичной консультации до дальнейших рекомендаций.
    Получить больше информации – [url=https://narcolog-na-dom-voronezh015.ru/]http://narcolog-na-dom-voronezh015.ru/[/url]

  2. Vicibet site is a well-known digital site that provides a diverse range of gaming options, from gambling activities to live betting [url=https://vicibet-3.vercel.app]vicibet casino online[/url] . Whether you’re searching for the top online casino or an thrilling wagering platform, Vicibet delivers a seamless and enjoyable environment for gamblers. Known for its intuitive layout and diverse selection of games, Vicibet site has earned a solid reputation among both new and skilled enthusiasts. If you’re looking for the trusted Vicibet platform destination, this service excels as a dependable pick for those seeking excitement and engaging gameplay.

    Vicibet digital casino features an vast range of games, including slots, classic casino games, and live dealer games. The site ensures a secure and fair entertainment space, making it a trusted choice for gamblers in the UK and beyond. With a focus on ease of use, Vicibet platform allows players to enjoy their favourite activities from anywhere, whenever, whether on desktop or smartphone screens. The convenience of Vicibet online wagering adds to its attraction, offering rapid access to live sports, competitive gaming, and other betting opportunities.

    For those first-time to Vicibet, the platform provides a friendly journey, complete with easy-to-follow guidance and informative tutorials. Whether you’re discovering Vicibet casino digitally or diving into real-time casino entertainment, the platform is crafted to accommodate all experience levels. The verified Vicibet destination also emphasises responsible gambling, encouraging honest gaming and ensuring gamblers stay educated about wagering restrictions and protection protocols.

    Vicibet platform betting goes beyond traditional gambling activities, offering live sports betting and competitive gaming events. This diversity makes it an perfect site for passionate bettors looking to participate in real-time wagering. The seamless combination of Vicibet platform live casino and wagering options ensures a lively and interactive user experience.

    To conclude, Vicibet platform continues to be a leading option for those seeking a reliable and entertaining digital gaming site. Whether you’re discovering Vicibet casino online or relishing live betting, the site delivers a seamless and thrilling experience. With its dedication to honesty, security, and variety, Vicibet platform continues to attract players looking for the ultimate in digital gaming.

  3. В статье по вопросам здоровья мы рассматриваем актуальные проблемы, с которыми сталкивается общество. Обсуждаются заболевания, факторы риска и важные аспекты профилактики. Читатели получат полезные советы о том, как сохранить здоровье и улучшить качество жизни.
    Ознакомиться с отчётом – [url=https://gazeta-echo.ru/metody-vyvoda-iz-zapoya/]Быстрый вывод из запоя[/url]

  4. Кодирование применяется после консультации нарколога и необходимого периода трезвости. Методика выбирается индивидуально. В клинической практике могут использоваться медикаментозное кодирование, инъекция, имплантация или подшивание препарата, а также психотерапевтические методы. В информационных материалах можно встретить названия Эспераль, Торпедо, Алгоминал, Аквилонг, Вивитрол, налтрексон и препараты дисульфирама. Ампулы, таблетки или капсулы имеют разные механизмы действия, показания и ограничения, поэтому конкретное средство назначается врачом.
    Получить больше информации – [url=https://narkologicheskaya-klinika-v-ekb21.ru/]наркологическая клиника цены Екатеринбург[/url]

  5. Лечение алкоголизма требуется, если человеку трудно остановиться после начала употребления, появляются запои, растет количество алкоголя или неоднократно возникают попытки прекратить пить без устойчивого результата.
    Ознакомиться с деталями – [url=https://narkologicheskaya-klinika-voronezh19.ru/]наркологическая клиника лечение алкоголизма Воронеж[/url]

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

  7. vicibet has become the top gambling platforms, delivering a exceptional experience for players of all levels [url=https://vici-bet-3.vercel.app]vici bet[/url] . Are you searching for a trustworthy ViciBet gambling site? Or perhaps a high-quality ViciBet gaming portal? This online platform provides a wide array of gaming choices. With its easy-to-navigate interface and diverse range of games, ViciBet has fast earned its place as a preferred option for those seeking a ViciBet digital experience.

    A key highlight of vicibet is its live ViciBet casino, which lets players partake in real-time gameplay and thrilling play. The site offers multiple payment methods, ensuring fast and secure transactions, which is essential for a problem-free ViciBet gaming session. Whether you love slot games, table games, or live sports wagering, ViciBet delivers a varied selection of options to match every preference.

    For those new to online gambling, ViciBet creates a welcoming atmosphere with lucrative promotions. The ViciBet’s verified website guarantees honesty and protection, making it a reliable destination for players looking for a trustworthy ViciBet gaming site. With a well-established standing in the industry, vicibet keeps drawing users looking for an enjoyable vici bet session.

    If you love classic casino games or cutting-edge real-time experiences, vicibet has something for everyone. Its commitment to fairness, security, and fun makes it a standout player in the online betting arena. If you’re hunting down the best ViciBet digital site, this platform is definitely worth checking out for an unforgettable and hassle-free adventure.

  8. В этой публикации мы исследуем ключевые аспекты здоровья, включая влияние образа жизни на благополучие. Читатели узнают о важности правильного питания, физической активности и психического здоровья. Мы предоставим практические советы и рекомендации для поддержания здоровья и развития профилактических подходов.
    Ссылка на источник – [url=https://sos09.ru/chastnaya-narkologicheskaya-klinika-v-irkutske/]Лечение алкоголизма в Иркутске[/url]

댓글 달기

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