如何在视图中获取当前页面的URL? [英] How to get the current page URL in the view?
本文介绍了如何在视图中获取当前页面的URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要使用我网站上所有页面中当前页面的URL来创建链接按钮.
I want to use URL of current page in all my pages on my site for creating link button.
我可以在控制器中执行以下操作:
I can do the following in my controller:
Http.Request.current().getBase() + Http.Request.current().url;
但是我该怎么做呢?有直接的方法吗?
But how can I do this in view? Is there direct way?
推荐答案
您可以在视图中访问Http.Request.current()
,就像request
一样.
You can access the Http.Request.current()
in the view, as simply request
.
所以,您需要
${request.getBase()}${request.url}
这篇关于如何在视图中获取当前页面的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文