강의

멘토링

커뮤니티

Inflearn Community Q&A

sofehyg1236158's profile image
sofehyg1236158

asked

Real-world! Spring Boot and JPA Utilization 1 - Web Application Development

View Environment Settings

static > index.html에서 a 태그 경로 질문 있습니다.

Written on

·

333

0

<a href="/hello">hello</a> 일 때에는 잘 동작하는데

<a href="resouces/templates/hello">hello</a>  일때에는 에러페이지 화면이 나오는 이유가 궁금합니다.

javaspring-boot웹앱JPAspring

Answer 2

1

petter님의 프로필 이미지
petter
Questioner

빠르고 친절한 답변 감사합니다.

1

yh님의 프로필 이미지
yh
Instructor

안녕하세요. yun님^^

경로를 /hello라고 하면 웹 브라우저가 서버에 localhost:8080/hello라는 경로로 요청을 하게 됩니다.

(실제 상단 웹 브라우저 url을 보시면 됩니다^^)

서버는 모든 요청을 컨트롤러에서 받습니다.

컨트롤러에 보시면 @GetMapping("hello")라고 해두어서 이 요청을 받을 수 있습니다.

그런데 경로를 resouces/templates/hello라고 하면 웹 브라우저가 localhost:8080/resouces/templates/hello라는 경로로 요청합니다.

그런데 서버의 요청은 컨트롤러가 받기 때문에 해당 경로를 처리할 수 있는 컨트롤러가 없어서 동작하지 않습니다.

도움이 되셨길 바래요^^

sofehyg1236158's profile image
sofehyg1236158

asked

Ask a question