How to use with an tag?

 <spring:url value="/something" var="url" htmlEscape="true"/>
 <a href="https://stackoverflow.com/questions/5007210/${url}">...</a>

But you an also use c:url

 <c:url value="/something" var="url"/>
 <a href="https://stackoverflow.com/questions/5007210/<c:out value="https://stackoverflow.com/questions/5007210/${url}"/>">...</a>

The one important difference between c:url and spring:url is, that c:url does not html encode the created url. But for a valid url the & between the url parameters must be a &amp;. So you need the c:out to escape it. — In spring:url you have this functionality already included (if I understand the documentation correct).

Namespaces:

  • xmlns:spring="http://www.springframework.org/tags"
  • xmlns:c="http://java.sun.com/jsp/jstl/core"

http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/spring.tld.html#spring.tld.url

Leave a Comment