我的JSP页面包含: script var bt_wd40_appurl = "${pageContext.request.contextPath}";/script view / source显示值“”.到目前为止我没有发现任何错误. 我的web.xml指定版本2.5. 如果您在ROOT上部署了webapp,它将
<script> var bt_wd40_appurl = "${pageContext.request.contextPath}"; </script>
view / source显示值“”.到目前为止我没有发现任何错误.
我的web.xml指定版本2.5.
如果您在ROOT上部署了webapp,它将为空.另见它的 javadoc(强调我的):getContextPath
java.lang.String getContextPath()
Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a “/” character but does not end with a “/” character. For servlets in the default (root) context, this method returns “”. The container does not decode this string.
您确定已将其部署在上下文路径上吗?请注意,上下文路径不包含URL的scheme / domain部分,它是域相对URL.