SpringBoot으로 웹 출시까지 #2

springboot logo

2. thymeleaf를 이용한 화면 작성

1 mythymeleaf 만들기

https://spring.io/guides/gs/serving-web-content/

https://start.spring.io/

 

project : maven

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

artifact, name : mythymeleaf

java: 8

dependencies : Thymeleaf / Spring Web / Spring Boot DevTools

2 greeting.html 만들기

greeting.html 만들기

3 GreetingController 만들기

controller 폴더를 만들어서 GreetingController 클래스 만들기

 

package com.example.mythymeleaf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class GreetingController {

@GetMapping("/greeting")
public String greeting(@RequestParam(name="name", required=false, defaultValue="World") String name, Model model) {
model.addAttribute("name", name);
return "greeting";
}

}

4 visual Studio code 열어서 html 편집

<!DOCTYPE HTML>
<html xmlns:th=“http://www.thymeleaf.org”>
<head>
    <title>Getting Started: Serving Web Content</title>
    <meta http-equiv=“Content-Type” content=“text/html; charset=UTF-8” />
</head>
<body>
    <p th:text=“‘Hello, ‘ + ${name} + ‘!'”>홍길동</p>
</body>
</html>

5 Live Server 다운로드 및 실행 / Five Server X

6 인텔리제이 mythymeleaf 실행

초록 삼각형 눌러서 실행 시키기

“Web server failed to start. Port 8080 was already in use.” 가 발생하셨다면 인텔리제이를 모두 껐다가 다시 실행시키시면 바로 해결됩니다.

“SpringBoot으로 웹 출시까지 #2”의 280개의 댓글

  1. I never thought I would find an app this reliable until I downloaded it a few weeks ago. The interface is clean and the daily bonuses keep me coming back. Watching my balance grow feels so rewarding after a long day. You really know how to make every session special casinodaysapp

  2. [8956]g999 Official Login | সেরা অনলাইন স্লট ও অ্যাপ ডাউনলোড,g999-এ সেরা অনলাইন স্লট গেম উপভোগ করুন। বিকাশ দিয়ে সহজ ডিপোজিট এবং অ্যাপ ডাউনলোড করে এখনই খেলা শুরু করুন। visit: g999

  3. [1412]Hoywin Login Oficial | Descarga la APK y Slots en Vivo,Entra a hoywin para disfrutar de los mejores slots en vivo y casinos con depósitos instantáneos. Aprende las reglas de ruleta y comienza a jugar ahora mismo. visit: hoywin

  4. [785]aaaaph: Online Casino Philippines | Login, Register & App Download,Experience the thrill of aaaaph, the premier online casino in the Philippines. Register today to enjoy secure logins, exciting games, and seamless app downloads for betting on the go. Join aaaaph for a world-class gaming experience. visit: aaaaph

  5. Logging in is always a hassle with other casinos but this place makes it so smooth. I love how they keep the interface clean and the customer support actually replies. Give in333login a try today and see the difference yourself.

  6. [3725]oklavip লগইন এবং অ্যাপ ডাউনলোড | বিকাশ অনলাইন ক্যাসিনো স্লট গেম,oklavip login করুন এবং সহজেই অ্যাপ download করে নিন। বিকাশ দিয়ে অনলাইন ক্যাসিনো গেমে অংশ নিন ও বোনাস পাওয়ার নিয়ম জানুন। আজই যোগ দিন। visit: oklavip

  7. [2610]58win1 | Link vào tải app và hướng dẫn chơi baccarat,58win1 cung cấp link vào chính thức để tải app, hướng dẫn nạp tiền qua momo casino và chia sẻ mẹo quay hũ nổ hũ hiệu quả. Truy cập ngay để trải nghiệm. visit: 58win1

댓글 달기

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