Thursday, October 1, 2009

Accessing the current request path with Freemarker and Spring MVC

Use this to get the URI prefix

<#assign lastSlashPos = Request['springMacroRequestContext'].requestUri?last_index_of("/") />
<#assign uriPrefix = Request['springMacroRequestContext'].requestUri?substring(0, lastSlashPos) />


Then construct your link

<a href="${uriPrefix}/myPath.html">click here</a>

0 comments:

Stats