【发布时间】:2020-12-04 18:35:21
【问题描述】:
在使用 Ktor 和 Thymeleaf 的应用程序中,我无法使用 ${session} 访问会话属性。 Thymeleaf documentation.
是否可以从 Thymeleaf 模板访问 Ktor 会话属性?
【问题讨论】:
在使用 Ktor 和 Thymeleaf 的应用程序中,我无法使用 ${session} 访问会话属性。 Thymeleaf documentation.
是否可以从 Thymeleaf 模板访问 Ktor 会话属性?
【问题讨论】:
在底层,Ktor 使用 Thymeleaf 的 IContext 的基本非 Web 实现,因此您无法在模板中获取会话属性,除非将它们作为变量显式传递。
我在 Ktor 问题跟踪器中创建了一个feature request 来解决这个问题。
【讨论】: