get Url base Url + ContextPath

var url = "${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}";

${pageContext.request.scheme} : http
${pageContext.request.serverName} : localhost
${pageContext.request.serverPort} : 8080
${pageContext.request.contextPath : contextPath

Leave a Reply