Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- Spring
- 프로그래머스
- 개발자취업
- 알고리즘
- DP
- 그래프 이론
- 우선순위큐
- 브루트포스
- 그리디
- 데이터베이스
- Til
- 네트워크 계층
- DFS
- BFS
- Java
- lower bound
- 항해99
- 스프링
- BinarySearch
- 99클럽
- 그래프
- 동적 프로그래밍
- 트리
- 코딩테스트준비
- 완전탐색
- 자바
- 백준
- 정렬
- 백트래킹
- 스프링 핵심 원리 - 기본편
Archives
- Today
- Total
AtraFelis's Develop Diary
[Spring] ResponseBody Annotation 본문
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
public class basicController {
@RequestMapping("/")
public String hello() {
return "index.html";
}
}
웹페이지에 접속하면 index.html
문서를 불러와 띄워주는 간단한 함수이다.
당연히 index.html이라는 문서가 없는데 불러오려고 한다면,
![]()
이런 오류 페이지가 나타난다.
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
public class basicController {
@RequestMapping("/")
@ResponseBody
public String hello() {
return "index.html";
}
}
하지만 위와 같이 @ResponseBody
를 붙인다면, index.html
문서가 반환되는 것이 아닌, "index.html"
이라는 문자열이 그대로 반환된다.
'Programming > Spring' 카테고리의 다른 글
[Spring] 스프링 컨테이너와 스프링 빈 (스프링 핵심원리 - 기본편 section5) (0) | 2025.01.12 |
---|---|
[Spring] 객체 지향 원리 적용하기 (스프링 핵심원리 - 기본편 section4) (0) | 2025.01.11 |
[Spring] 객체 지향 설계와 스프링 (스프링 핵심 원리 - 기본편 Section2) (0) | 2025.01.10 |
[Spring] 스프링 프레임워크와 스프링 부트 (0) | 2025.01.08 |
[Spring] 김영한 님의 스프링 입문 강의를 수강하고 (0) | 2025.01.01 |