spring-guides / tut-spring-boot-kotlin

Building web applications with Spring Boot and Kotlin :: Learn how to easily build and test web applications with Spring, Kotlin, Junit 5 and JPA

Home Page:https://spring.io/guides/tutorials/spring-boot-kotlin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

官方教程中存在错误

308299160 opened this issue · comments

在“Implementing the blog engine”这部分。
blog.mustache这个文件中有:
<h2 class="article-title"><a href="/article/{{id}}">{{title}}</a></h2>
然而在后面给出的RenderedArticle代码里面,不存在id这个字段。在github里面blog.mustache的代码则是
<h2 class="article-title"><a href="/article/{{slug}}">{{title}}</a></h2>

其次,blog.mustache和header.mustache文件中都引用了{{title}},但是在HtmlController中却是:
@GetMapping("/") fun blog(model: Model): String { model["articles"] = repository.findAllByOrderByAddedAtDesc().map { it.render() } return "blog" }
没有title。

Hey, any chance you could translate the issue title and description to english?

I try my best!
There was an error in the official tutorial !
In this section "Implementing the blog engine" in official tutorial,
{{id}} is used in the blog.mustache file, id property is not found in RenderedArticle.class.
{{slug}} is used in the blog.mustache in github.

In addition, {{title}} is used in both blog.mustache and header.mustache, but in HtmlController
fun blog(model: Model): String {
model["articles"] = repository.findAllByOrderByAddedAtDesc().map { it.render() }
return "blog"
}
there is no model["title"].

Can you see what I mean
url of official tutorial: https://spring.io/guides/tutorials/spring-boot-kotlin/

Fixed, thanks for spotting this, and your english is as good as mine ;-)