I would like to use a URL generated with spring’s <spring:url> in a <jsp:include> tag, but it is appending the context path twice. I am using Spring MVC 3.1.
<spring:url var="publicationUrl" value="/publications/{id}">
<spring:param name="id" value="${publication.id}" />
</spring:url>
<!-- publicationUrl = "/myApp/publications/1234" -->
<!-- Both methods fail because they are appending the -->
<!-- context again: "/myApp/myApp/publications/1234" -->
<jsp:include page="${publicationUrl}" />
<c:import url="${publicationUrl}" />
I have found a way to prevent
spring:urlfrom prepending the context path. I have to add an empty context:This solution is not perfect as I have to create two different URLs: one for the links and another one for the includes.