FreeMarker-获取当前URL [英] FreeMarker - Get Current URL

查看:592
本文介绍了FreeMarker-获取当前URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过FTL获取当前页面的URL?

Is it possible to get the current page's URL in FTL?

推荐答案

据我所知,freemarker严格来说是一个模板引擎-它仅产生文本,而无法知道该文本将出现在何处.如果要包括当前页面的URL",则必须将数据从主机Java代码传递到模板中(推荐),或者必须使用javascript在客户端进行检测.

As far as I can tell, freemarker is strictly a templating engine -- it simply produces text, and has no way of knowing where that text will appear. If you want to include the "current page's URL", you'll either have to pass that data into the template from the host Java code (recommended) or you'll have to detect it client-side using javascript.

这篇关于FreeMarker-获取当前URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆