In the JSP to take the ${pageContext.request.contextPath}, way one can be normally taken, but the way two but take the
Character " ${pageContext.request.contextPath} "
Mode one:
<script type= "Text/javascript" >
var t = "${pagecontext.request.contextpath}";
<script>
Mode two:
<script src= "${ctx}/jqgrid.js" type= "Text/javascript" >
</script>
jqgrid.js:
function Jqgridinclude ()
{
var t = ' ${pagecontext.request.contextpath} ';
}
Jqgridinclude ();
-----Solution--------------------
That's because ${pagecontext.request.contextpath} is not javascript at all, but the El of JSP. You write ${pagecontext.request.contextpath} into a JS file, the JSP compiler does not deal with it at all.
${} is an El expression. Can only be used in JSP files. JS file with this is a string.
The above is a small set of JavaScript to introduce ${pagecontext.request.contextpath} value problems and solutions, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!