Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

템플릿 파싱 에러 #11

Closed
Ma-rk opened this issue May 26, 2020 · 4 comments
Closed

템플릿 파싱 에러 #11

Ma-rk opened this issue May 26, 2020 · 4 comments

Comments

@Ma-rk
Copy link

Ma-rk commented May 26, 2020

안녕하세요 김영재님
"처음 배우는 스프링 부트2" 를 보고 따라하다가 에러를 해결하지 못해 질문드립니다.

114 페이지를 보면 "예제 4-12" 에서 list.html 파일이 나오는데요
웹서버를 구동하고 http://localhost:8080/board/list 로 접속을 하면
다음과 같은 에러가 발생합니다.

There was an unexpected error (type=Internal Server Error, status=500).
An error happened during template parsing (template: "class path resource [templates//board/list.html]";)
org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates//board/list.html]";)

Caused by: org.attoparser.ParseException: Error resolving template [layout/header], template might not exist or might not be accessible by any of the configured Template Resolvers (template: "/board/list" - line 10, col 6)

에러 내용을 읽어보면

부분을 처리하지 못해 에러가 나는것 같은데 저자님의 깃허브에 올라와 있는 코드를 그대로 복붙해도 여전히 에러가 발생하고 있습니다. 어떻게 하면 해결할 수 있을까요?

출처: https://haviyj.tistory.com/guestbook [What do you want?]

@young891221
Copy link
Owner

young891221 commented May 26, 2020 via email

@Ma-rk
Copy link
Author

Ma-rk commented May 26, 2020

안녕하세요, 답변주셔서 감사합니다.

답변 주신걸 보고 컨트롤러 메소드의 리턴 부분을
return "board/form"; 그리고
return "board/list"; 로 바꿔서 다시 시도해봤는데요, 같은 에러가 발생합니다...(메시지는 약간 바뀌었습니다)

에러 내용은 어제처럼
[THYMELEAF][http-nio-8080-exec-1] Exception processing template "board/list": An error happened during template parsing (template: "class path resource [templates/board/list.html]")
org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/board/list.html]")
Error resolving template [/layout/header], template might not exist or might not be accessible by any of the configured Template Resolvers (template: "board/list" - line 10, col 6)
인데요... 어느 부분을 확인해보면 에러를 고칠 수 있을까요??

다음은 list.html 파일의 경로와 컨트롤러의 코드입니다

스크린샷 2020-05-26 14 10 40

@controller
@RequestMapping({"/board"})
public class BoardController {
BoardService boardService;

public BoardController(BoardService boardService) {
this.boardService = boardService;
}

@GetMapping({"", "/"})
public String board(@RequestParam(value = "idx", defaultValue = "0") Long idx, Model model) {
model.addAttribute("board", boardService.findBoardByIdx(idx));
return "board/form";
}

@GetMapping({"/list"})
public String list(@PageableDefault Pageable pageable, Model model){
model.addAttribute("boardList", boardService.findBoardList(pageable));
return "board/list";
}
}

@young891221
Copy link
Owner

young891221 commented May 26, 2020 via email

@Ma-rk
Copy link
Author

Ma-rk commented Jun 5, 2020

프로젝트 경로 안에 스태틱 리소스가 없어서 나는 에러였습니다.
해당 쳅터의 맨 뒤쪽에 설명이 있네요...
문제는 해결됐습니다. 감사합니다.

@Ma-rk Ma-rk closed this as completed Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants