728x90
post.css
table {
border-collapse: collapse;
border-spacing: 0;
}
section.post {
padding: 80px 0;
}
.page-title {
margin-bottom: 40px;
}
.page-title h3 {
font-size: 28px;
color: #333333;
font-weight: 400;
text-align: center;
}
.login-info {
margin-bottom: 10px;
text-align: right;
}
#post-search .search-window {
padding: 16px 0;
background-color: #f9f7f9;
}
#post-search .search-window .search-wrap {
position: relative;
margin: 0 auto;
width: 80%;
max-width: 564px;
}
#post-search .search-window .search-wrap input {
height: 40px;
width: 100%;
font-size: 14px;
padding: 7px 14px;
border: 1px solid #ccc;
}
#post-search .search-window .search-wrap input:focus {
border-color: #333;
outline: 0;
border-width: 1px;
}
#border-search .search-window .search-wrap .btn {
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 108px;
padding: 0;
font-size: 16px;
}
.post-table {
font-size: 13px;
width: 100%;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
.post-table a {
color: #333;
display: inline-block;
line-height: 1.4;
word-break: break-all;
vertical-align: middle;
}
.post-table a:hover {
text-decoration: underline;
}
.post-table th {
text-align: center;
}
.post-table .th-num {
width: 100px;
text-align: center;
}
.post-table .th-viewcnt {
width: 100px;
text-align: center;
}
.post-table .th-date {
width: 200px;
}
.post-table th,
.post-table td {
padding: 14px 0;
}
.post-table tbody td {
border-top: 1px solid #e7e7e7;
text-align: center;
}
.post-table tbody th {
padding-left: 28px;
padding-right: 14px;
border-top: 1px solid #e7e7e7;
text-align: left;
}
.post-table tbody th p {
display: none;
}
.btn {
display: inline-block;
padding: 0 30px;
font-size: 15px;
font-weight: 400;
background: transparent;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border: 1px solid transparent;
text-transform: uppercase;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
-ms-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
}
.btn-dark {
background: #555;
color: #fff;
}
.btn-dark:hover,
.btn-dark:focus {
background: #373737;
border-color: #373737;
color: #fff;
}
.btn-dark {
background: #555;
color: #fff;
}
.btn-dark:hover,
.btn-dark:focus {
background: #373737;
border-color: #373737;
color: #fff;
}
* {
list-style: none;
text-decoration: none;
padding: 0;
margin: 0;
box-sizing: border-box;
}
.clearfix:after {
content: "";
display: block;
clear: both;
}
.container {
width: 1100px;
margin: 0 auto;
}
.blind {
position: absolute;
overflow: hidden;
clip: rect(0 0 0 0);
margin: -1px;
width: 1px;
height: 1px;
}
list.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>게시판 목록보기</title>
<link rel="stylesheet" href="post.css">
</head>
<body>
<section class="post">
<div class="page-title">
<div class="container">
<h3>글 목록보기</h3>
</div>
</div>
<div class="login-info">
<div class="container">
<span class="login-info_user" th:if="${loginInfo != null}">
<span th:text="${loginInfo.name}"></span>
</span>
<span class="login-info_logout" th:if="${loginInfo != null}">
<a href="/logout">로그아웃</a>
</span>
<span class="login-info_login" th:if="${loginInfo == null}">
<a href="/loginform">로그인</a>
</span>
<span class="login-info_join" th:if="${loginInfo == null}">
<a href="/userRegForm">회원가입</a>
</span>
</div>
</div>
<!-- post list area -->
<div id="post-list">
<div class="container">
<table class="post-table">
<thead>
<tr>
<th scope="col" class="th-num">번호</th>
<th scope="col" class="th-title">제목</th>
<th scope="col" class="th-viewCount">조회수</th>
<th scope="col" class="th-name">작성자</th>
<th scope="col" class="th-date">등록일</th>
</tr>
</thead>
<tbody>
<tr th:each="post : ${list}">
<td th:text="${post.postId}"></td>
<th>
<a th:href="@{post(postId=${post.postId})}" th:text="${post.title}"></a>
<p>테스트</p>
</th>
<td th:text="${post.viewCount}"></td>
<td th:text="${post.name}"></td>
<td th:text="${post.updatedAt}"></td>
</tr>
</tbody>
</table>
</div>
<div class="container">
<a href="/writeForm" th:if="${loginInfo != null}">글쓰기</a>
<span th:if="${loginInfo == null}">글쓰기</span>
</div>
<div class="container">
<span th:each="n : ${#numbers.sequence(1, pageCount)}"><a th:href="@{/(page=${n})}" th:text="${n}"></a></span>
</div>
</div>
</section>
</body>
</html>
loginform.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>로그인 폼</title>
</head>
<body>
<h1>로그인 폼</h1>
<form action="/login" method="post">
email : <input type="text" name="email" /><br/>
암호 : <input type="password" name="password" /><br/>
<input type="submit" value="로그인">
</form>
</body>
</html>
post.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>게시물 상세보기</title>
</head>
<body>
<h1 th:text="${post.title}"></h1>
<div>글쓴이 : <span th:text="${post.name}"></span></div>
<div>제목 : <span th:text="${post.title}"></span></div>
<div>조회수 : <span th:text="${post.viewCount}"></span></div>
<div>공개 : <span th:text="${post.is_public}"></span></div>
<div>작성일 : <span th:text="${post.regdate}"></span></div>
<div>내용 : <span th:text="${post.content}"></span></div>
<div><a href="/">목록보기</a></div>
<div><a th:href="@{/updateform(postId=${post.postId})}" th:if="${(loginInfo != null) && (loginInfo.getUserId() == post.getUserId())}">수정하기</a></div>
<div><a th:href="@{/delete(postId=${post.postId})}" th:if="${(loginInfo != null) && (loginInfo.getUserId() == post.getUserId())}">삭제하기</a></div>
</body>
</html>
updateform.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>수정 폼</title>
</head>
<body>
<h1>수정 폼</h1>
<form action="/update" method="post">
<input type="hidden" name="postId" th:value="${post.postId}">
이름 : <span th:text="${loginInfo.name}"></span><br>
제목 : <input type="text" name="title" th:value="${post.title}"><br>
내용 : <br>
<textarea name="content" cols="50" rows="5" th:value="${post.content}"></textarea><br>
<input type="submit" value="수정">
</form>
</body>
</html>
userRegForm.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>회원가입 폼</title>
</head>
<body>
<h1>회원가입 폼</h1>
<!-- http://localhost:8080/userReg -->
<form action="/userReg" method="post">
이름 : <input type="text" name="name" /><br/>
email : <input type="text" name="email" /><br/>
암호 : <input type="password" name="password" /><br/>
<input type="submit" value="회원가입">
</form>
</body>
</html>
welcome.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>회원가입 환영</title>
</head>
<body>
<h1>회원가입을 환영합니다.</h1>
<a href="/loginform">로그인</a><br>
<a href="/">HOME</a>
</body>
</html>
writeForm.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>글쓰기 폼</title>
</head>
<body>
<h1>글쓰기 폼</h1>
<form action="/write" method="post">
이름 : <span th:text="${loginInfo.name}"></span><br>
제목 : <input type="text" name="title"><br>
내용 : <br>
<textarea name="content" cols="50" rows="5"></textarea><br>
<input type="submit" value="등록">
</form>
</body>
</html>
728x90
'백엔드 > Java' 카테고리의 다른 글
왜 자바는 여전히 강력한가? (0) | 2025.10.01 |
---|---|
[개인 프로젝트] 게시판 만들기 5 - 공개, 비공개 기능 (0) | 2025.09.28 |
[개인 프로젝트] 게시판 만들기 3 - PostDTO 수정 (0) | 2025.09.26 |
[개인 프로젝트] 게시판 만들기 2 - DTO, DAO(User, Post, LoginInfo) 작성 (0) | 2025.09.25 |
[개인 프로젝트] 게시판 만들기 1 - DB 설계하기 (0) | 2025.09.24 |