码迷,mamicode.com
首页 > 其他好文 > 详细

在 Freemarker 中获取 ContextPath

时间:2018-05-16 15:10:23      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:response   ase   mac   3.1   Servle   ons   gets   abstract   AC   

使用 ${springMacroRequestContext.contextPath} 即可,只是从原来的 ${request.contextPath} 稍作修改。


springMacroRequestContext 是个什么东西呢?

最后在 spring-webmvc 这个包中找到了答案,具体是 org\springframework\web\servlet\view\AbstractTemplateView.class 这个类,在 4.3.14.RELEASE 这个版本中,第 88 行:

model.put("springMacroRequestContext", new RequestContext(request, response, this.getServletContext(), model));

在 Freemarker 中获取 ContextPath

标签:response   ase   mac   3.1   Servle   ons   gets   abstract   AC   

原文地址:https://www.cnblogs.com/StarUDream/p/9045493.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!