Is it possible to get the current page's URL in FTL?
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.
I'm running Spring 3.2.x and exposeSpringMacroHelpers defaults to true.
As per Spring Documentation
Set whether to expose a RequestContext for use by Spring's macro library, under the name "springMacroRequestContext". Default is "true".
On my view, I can then do something like
<#if springMacroRequestContext.requestUri?contains("/login")>
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With