- 테이블 변경


table 변경 시 entity도 변경
PostService

→ String project path 프로젝트 경로를 담아줌
→ 파일의 이름을 붙일 랜덤 이름 생성
→ uuid 식별자 + _ + 원래 파일 이름
→ saveFile = 파일 생성 후 projectPath에 넣고 이름 설정
PostView.html
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>게시글 상세 페이지</title>
</head>
<body>
<h1 th:text = "${post.title}">제목입니다.</h1>
<p th:text = "${post.content}">내용이 들어갈 부분입니다.</p>
<a th:href ="@{${post.filepath}}">사진</a>
<a th:href="@{/post/delete(id=${post.id})}">글 삭제</a>
<a th:href="@{/post/modify/{id}(id = ${post.id})}">수정</a>
</body>
</html>
th:href = a태그에 경로 걸 때 사용
th:text = 태그에 문자열을 출력할 때 사용
(변수는 $로 감싸야함)
- 실행






파일 업로드 에러 및 디버깅
[Spring Boot Project] 파일 업로드 에러 및 디버깅
첫 번째 에러파일 업로드 시 Null Point Exception 발생 디버깅controller에서 받아오는 매게 변수 이름이랑 일치해야 한다 file : null 에러 확인 name을 추
shyeeon.tistory.com
'Project > Study Website Project' 카테고리의 다른 글
| [Spring Boot Project] 페이징 처리 (0) | 2025.01.21 |
|---|---|
| [String Boot Project] 게시글 메시지 (1) | 2025.01.20 |
| [Spring Boot Project] 게시글 삭제 및 수정 (0) | 2025.01.14 |
| [Spring Boot Project] 게시글 리스트 및 상세 페이지 (0) | 2025.01.14 |
| [Spring Boot Project] 게시글 생성 (0) | 2025.01.13 |