freemarker中如何获取session中的id、创建时间等等

zhou_077 2018-07-19 11:55:54
springboot
这是我的配置文件
spring:
###freemarker配置
freemarker:
cache: false
charset: UTF-8
check-template-location: true
content-type: text/html
expose-request-attributes: true
expose-session-attributes: true
request-context-attribute: request
suffix: .ftl
settings:
template_update_delay: 5


页面上${request.contextPath}可以获取对应的项目名
但是我现在想获取session中自带的id、session的创建时间 该怎么获取
查阅了下都是后续在session中set的值可以拿
同理我想获取request中的port、serverName也获取不了 只能获取request.contextPath
为啥。。。
...全文
369 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
楼主找到答案了吗?free marker的session 其实是获取的是Attribute中的值,而不是session本身。对吧?怎么拿ID呢?
java1357924680 2018-07-19
  • 打赏
  • 举报
回复
按这个试一下
https://stackoverflow.com/questions/6833765/get-server-name-and-scheme-in-freemarker-with-spring-mvc

★请阅读本人博客的《答题协议

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧