inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발

html 파일로 인식못하는 문제 궁금합니다.

895

ymyj33

작성한 질문수 3

0

안녕하세요. 선생님

회원등록하는 부분에 members폴더 만들고 하위에 createMemberForm.html을 생성했는데

html파일로 인식을 하지 않습니다.. 어떠한 경우에 이렇게되는건가요? 다른 파일 test.html을 생성해보면 정상적으로 되는데.. 이것만 그렇습니다.. 왜그런지 이유가 궁금합니다.

spring-boot rest-api

답변 1

0

Dowon Lee

안녕하세요, 이도원입니다. 

죄송하지만, 질문하신 내용을 다시 확인하고 싶습니다다. 

/resources/templates 폴더에 html 파일을 생성하였는데, test.html 파일은 정상적으로 작동하고, createMemberForm.html 파일은 작동하지 않는다는 것인가요? application.yml 파일이나(또는 application.properties) pom.xml 파일에 관련 설정은 되어 있을까요? 본 과정에서는 RestController만을 사용했는데, 웹 페이지등을 보여주기 위해 Controller를 추가할 때에 대한 설정입니다. test.html 파일은 /resources 폴더 밑에 생성하시면 됩니다. 

<pom.xml>

    <!-- WEB -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>

<application.yml>

spring:
thymeleaf:
prefix: classpath:templates/
check-template-location: true
suffix: .html
mode: HTML5
cache: false
template-resolver-order: 0

<test.html>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
Hello, World
</body>
</html>

<HelloWorldWebController.java>

@Controller
public class HelloWorldWebController {
@GetMapping("/test")
public String getUser() {
return "test";
}

확인해 보시고, 문의사항 있으시면 다시 연락 주세요. 

감사합니다. 

JPA

0

57

1

jpa dependency를 추가하고 SecurityConfig클래스에서 오류가 납니다.

0

68

1

웹 브라우저 400 bad request

0

71

1

@Size는 되는데 @Past는 안 됩니다.

0

61

1

pdf 자료는 없나요?

0

73

2

locale 정보가 null 이면 무조건 messages_ko.properties이 호출 되는 문제

0

87

2

Swagger 강의, Unable to infer base url 이거 뜨시는 분들 도움되시라고

0

118

1

강의에서나온 화면 피피티

0

158

1

HelloWorldBean 관련 에러

0

183

2

Swagger API 3.x 오류..

0

219

1

java: variable message not initialized in the default constructor 에러는 어찌하면 좋을까요?

1

282

1

현재 GIT에 올리신 소스를 실행해봤습니다.

0

189

2

고양이 소리가 귀엽네요 !!

0

137

2

git에서 소스받고 실습중인데

0

117

1

post가 안되요

0

102

1

한국어 같은 경우 언어코드인 messages_ko.properties 로 생성하는게 더 좋지 않나요?

0

168

2

리턴타입으로서 EntityModel<User> 와 ResponseEntity질문

0

104

1

예외처리쪽 관련 질문있습니다.

0

159

2

엔티티가 바로 응답으로 나가도 되나요??

0

221

2

안녕하세여 Cannot invoke "co.kr.joneconsulting.resfulservice.repository.PostRepository.save(Object)" because "this.postRepository" is null

0

135

2

사용자 등록하고 나서 H2 에서 보면 신규 사용자의 password, ssn 이 null 로 되어 있습니다.

0

140

2

ApplictionContext 질문

0

192

2

롬북이 안먹히는것같아요

0

156

1

인텔리제이에서스프링부트 파일 실행하면

0

240

1