首页 文章

无法加载资源:服务器响应状态为404(未找到)[重复]

提问于
浏览
1

这个问题在这里已有答案:

即时尝试加载网格(xml)的servlet,我得到了错误“无法加载资源:服务器响应服务器状态为404(未找到)错误” . 我怎么解决这个问题?

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Data Binding Example</title>
<!-- <script type="text/javascript" src="ext-5.1.1/ext-all.js"></script> -->

<script type="text/javascript" src="ext-5.1.1/build/ext-all-debug.js"></script>

<link rel="stylesheet" type="text/css"
    href="ext-5.1.1/examples/shared/example.css" />

<!-- GC -->

<script type="text/javascript"
    src="ext-5.1.1/examples/shared/include-ext.js"></script>
<script type="text/javascript"
    src="ext-5.1.1/examples/shared/options-toolbar.js"></script>

<!-- page specific -->
<script type="text/javascript" src="app.js"></script>
</head>
<body>
    <h1>Data Binding Example</h1>
<!--    <p> -->
<!--        This example expands upon the <a href="xml-grid.html">XML Grid -->
<!--            example</a> and shows how to implement data binding for a master-detail -->
<!--        view. -->
<!--    </p> -->
<!--    <p> -->
<!--        Note that the js is not minified so it is readable. See <a -->
<!--            href="app.js">app.js</a>. -->
<!--    </p> -->
    <div id="binding-example"></div>
</body>
</html>

1 回答

  • -1

    还要确保您的链接正确,请尝试使用绝对路径:

    "<a href="/HomeDirectory/Data/Xml/xml-grid.html">"
    

    如果这不起作用或提供更多信息 .

    如果您没有任何服务器端代码,则很难从目录中加载XML文件 .

    如果内容非常简单(例如只是一个列表),那么您的文件可能只是一个简单的数组 .

    var questions = [
      "What time is it?",
      "Is the sky blue?",
      "What do you call a fish with no legs?"
    ];
    

    您可以使用脚本标记在页面中包含此文件:

    <script src="questions.js"></script>
    

    如果您的问题结构更复杂,您可以将其包含在允许复杂嵌套等的JSON格式中 .

    var questions = [
      {
        "id":1,
        "question":"What time is it?",
        "datatype":"text"
      },
      {
        "id":2,
        "question":"Is the sky blue?",
        "datatype":"boolean"
      },
      {
        "id":3,
        "question":"What do you call a fish with no legs?",
        "datatype":"text"
      }
    ];
    

相关问题