You can use ${pageContext.request.contextPath}. For example, to get href = "/my-app/somePage", use:
<a href="${pageContext.request.contextPath}/somePage">
URL, cookie. , - JSTL <c:url/>:
<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
...
<a href="<c:url value = '/somePage' />">