My JSP page contains:
<script>
var bt_wd40_appurl = "${pageContext.request.contextPath}";
</script>
view/source shows "" for the value. No errors I've found so far.
my web.xml specifies version 2.5.
My JSP page contains:
<script>
var bt_wd40_appurl = "${pageContext.request.contextPath}";
</script>
view/source shows "" for the value. No errors I've found so far.
my web.xml specifies version 2.5.
It will be empty if you deployed the webapp on ROOT. See also its javadoc (emphasis mine):
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.
Are you sure that you did deploy it on a context path? Note that the context path doesn't contain the scheme/domain part of the URL, it's a domain-relative URL.