在独立的javascript文件中获取不到jsp中的

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";    
%>

但现在我们的框架要求必须图片什么的是完整的http路径 ,所以黄海撰写了下面的javascript 代码:

 

var url = location.href;
var mystr = url.split("/");
var FinaleImagePath = mystr[0] + "//" + mystr[2] + "/" + mystr[3] + "/" + "images/loadingAnimation.gif";
var xxPngPath = mystr[0] + "//" + mystr[2] + "/" + mystr[3] + "/" + "images/xx.png";

相关文章:

  • 2021-12-08
  • 2021-10-28
  • 2022-12-23
  • 2021-09-06
  • 2021-08-11
  • 2022-02-07
  • 2021-12-08
猜你喜欢
  • 2021-12-10
  • 2021-12-26
  • 2021-12-08
  • 2022-12-23
  • 2021-12-08
  • 2021-11-26
相关资源
相似解决方案