Always use the EL expression ${pageContext.request.contextPath} to pass the application name. It is very troublesome when using JS. Although it can be used, it increases the code complexity. Therefore, it is recommended to use JS to get the application name.
function getContextPath() { var contextPath = document.location.pathname; var index =contextPath.substr(1).indexOf("/"); //There may be problems in this place. You need to modify the contextPath appropriately according to the specific project. ContextPath = contextPath.substr(0,index+1); delete index; return contextPath; }The above simple example of obtaining the site application name of js is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.