【问题标题】:images are not loading inside WEB-INF folder?图像没有加载到 WEB-INF 文件夹中?
【发布时间】:2013-07-19 23:37:54
【问题描述】:

我在 WEB-INF 文件夹中有some.jsp。在jsp里面我有下面的代码。

<script type="text/javascript" src="../public/js/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="../public/js/form.js"></script>

form.js 里面我有以下代码:

$('#theform #formProgress').html('<img src="/images/ajax-loader.gif" /> Saving&hellip;');

ajax-loader.gifwebapp/public/images 文件夹中。

但是图片没有加载。请帮帮我。

谢谢!

【问题讨论】:

  • 我也应该提到公开吗?谢谢!
  • 你的JS文件可以,为什么你的图片不行?

标签: java javascript jquery ajax html


【解决方案1】:

您自己的文字回答了这个问题:您使用了错误的文件路径:

$('#theform #formProgress').html('<img src="/public/images/ajax-loader.gif" /> Saving&hellip;');

如果图像在/public/images 中,为什么要尝试从/images 加载它?

【讨论】:

    【解决方案2】:

    您的form.js 在哪里?如果它在public/js 目录中并且图像在public/images 中,那么您只需要编写:

    $('#theform #formProgress').html('<img src="../images/ajax-loader.gif" /> Saving&hellip;');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-18
      • 2020-01-22
      • 1970-01-01
      • 2015-01-23
      相关资源
      最近更新 更多