get Url base Url + ContextPath

<br />
var url = &quot;${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}&quot;;<br />

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

Leave a Reply