In jstl we can access the current urlURL path using pageContext.request.contextPath,. If you want to do a ajaxan Ajax call, use the following urlURL.
url = "${pageContext.request.contextPath}" + "/controller/path"
ExExample: inFor the page http://stackoverflow.com/posts/36577223 this will give http://stackoverflow.com/controller/path.