ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๋ฐ˜์‘ํ˜•
์ƒˆ๋กœ์šด ํด๋ž˜์Šค ์ƒ์„ฑ

 

MemberVO.java ์†Œ์Šค์ฝ”๋“œ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.springboot.boot03.sample.model;
 
import java.sql.Timestamp;
 
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
 
@Data
@AllArgsConstructor //๋ชจ๋“  ํ•„๋“œ๋ฅผ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ํ†ตํ•ด ์ดˆ๊ธฐํ™”ํ•˜๋Š” ์ƒ์„ฑ์ž
@NoArgsConstructor //๊ธฐ๋ณธ ์ƒ์„ฑ์ž ์„ ์–ธ
public class MemberVO {
    
    private Integer memberNo;
    private String memberId;
    private String memberPw;
    private String memberName;
    private Timestamp regDate;    
    
        
}
 
 

 

sample2.html ์†Œ์Šค์ฝ”๋“œ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Thymeleaf3</title>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
</head>
<body>
    <h1>Sample2 ํŽ˜์ด์ง€์ž…๋‹ˆ๋‹ค.</h1>
    <h2 th:text="${member}"></h2>
    <div th:text="${'์ด๋ฆ„: ' + member.memberName}"></div>
    <div>์•„์ด๋””: [[${member.memberId}]]</div>
    <div th:utext="${'<h3>' + member.memberId + '</h3>'}"></div>
    <div><h3>[[${member.memberId}]]</h3></div>
</body>
</html>
 

 

SampleController.java
1
2
3
4
5
6
7
8
9
    @GetMapping("/sample2")
    public void sample2(Model model) {
        MemberVO member = new MemberVO(
                    100"abc1234""aaa1234!""๊น€์ฒ ์ˆ˜"
                    new Timestamp(System.currentTimeMillis())
                );
        
        model.addAttribute("member", member);
    }
 

 

๊ฒฐ๊ณผํŽ˜์ด์ง€

 

 

 

๋ฐ˜์‘ํ˜•
๋Œ“๊ธ€