我试图为网格(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>
答案 0 :(得分:-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"
}
];