스프링하다 생긴 문제인데 스프링 게시판이 안보여서 여기다 작성합니다.!!
스프링 강의에서 detail.html을 아래와 같이 만들었습니다.
nav.html을 불러왔고 list.html처럼 nav에 css를 입혀주기 위해
<link href="main.css" rel="stylesheet">
코드를 사용해봤지만 아래와 같은 오류 메세지가 나면서 detail.html에는 css가 입혀지지 않았습니다.
Resolved [org.springframework.web.method.annotation.MethodArgumentTypeMismatchException:
Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'; For input string: "main.css"]
제가 아직 지식이 없어 여기저기 검색하고 지피티한테도 마땅한 답변을 얻지 못해 결국 외부 css를 사용하는 것이 아닌 내부 스타일 시트로 해결했는데.
어떻게 해야지 외부 시트를 사용할 수 있을까요? href로 불러오면서 main.css가 컨트롤러의 @Pathvariable 로 같이 넘어가서 생기는 오류일까요?
너무 답답합니다 ㅜㅜ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>상세페이지</title>
<style>
.nav {
display: flex;
padding: 10px;
align-items: center;
font-family : 'Montserrat';
}
.nav a {
margin-right: 10px;
text-decoration : none;
font-weight : 400;
letter-spacing : -0.5px;
}
.nav .logo {
font-weight : 800;
}
</style>
<style>
.edit-btn {
background-color: red;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
text-decoration: none;
}
</style>
</head>
<body>
<div th:replace="~{ nav.html::navbar }"></div>
<div class="detail">
<h4>상세페이지</h4>
< img src="https://placehold.co/300">
<h4 th:text="${item.title}"></h4>
<h4 th:text="${item.price}"></h4>
수정
</div>
</body>
</html>