${pageContext.request.contextPath} works fine local, but shows blank live

試著忘記壹切 提交于 2019-12-06 13:19:06

That will happen when it's deployed to root. E.g. as ROOT.war in Tomcat, or having a context path of /. The ${pageContext.request.contextPath} will then resolve to an empty string.

If you're actually seeing a "context path" in browser's address bar URL, then it can happen when the webapp is published to a (poor) 3rd party host which in turn actually deploys the webapp as root and adds that "context path" to some proxy server on that host. You could check/confirm that by checking the Server entry in the response headers. You'd best contact the 3rd party host for clues about how to obtain information about that "context path" from the proxy server (perhaps it's present in a request header), or look for a different 3rd party host which is less el cheapo.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!