I have SpringMVC project with Freemarker as view resolver. In some templates I have to generate links including hostname, but I can't get it. In JSP I may to do like this:
`<% String hostName=request.getServerName();%>`
I tried to use "requestContextAttribute
", but requestContext.getContextPath()
returned path without hostname.
Where can I get full path or hostname separately?
We can do this in JSTL. Try adapting it in FreeMarker:
${pageContext.request.serverName}
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