So far I've tried using
<c:url var="root" value="/"/>
which works alright (${root} will give the context-root /myapp/)
This is not the right way. The <c:url>
should be applied on every single URL individually.
You'd better use
<c:set var="root" value="${pageContext.request.contextPath}" />