<script> causing problem with XML tag name mismatch

3

在尝试使用一个测试页面进行一些jQuery getJSON调用时,我遇到了错误,这些错误显示在Firefox的错误控制台中:

XML tag name mismatch (expected input)
http://localhost:8080/<MyApp>/jquery-1.4.4.js
</body>

XML tag name mismatch (expected input)
http://localhost:8080/<MyApp>/json.js
</body>

The original html has the following:

<html>
  <head>
    <title>Application</title>
      <script type="text/javascript" src="/<MyApp>/jquery-1.4.4.js"></script>
      <script type="text/javascript" src="/<MyApp>/json.js"></script>
  </head>
  <body>
    <h1>Application</h1>
    <p>
    <label id="heartbeatLabel">Gateway Heartbeat:</label>
    <input id="heartbeatStatus" type="text" readonly="true" width="30">
    <input id="jsRunning" type="text" readonly="true" width="30">
    <input id="btnHeartbeat" type="button" value="Test Heartbeat" onclick="javascript:testHeartbeat();">
  </body>

Firebug告诉我javascript脚本都被找到了,Net面板显示状态码200。有什么建议吗?

<p>标签没有关闭,<html>标签也没有关闭(除非您在复制/粘贴时错过了它)。我不认为这是错误的原因,但仍应该修复。此外,<input>标签应该是自闭合的:<input id="..." />。 - Aasmund Eldhuset
1个回答

1

这行代码无效:

<script type="text/javascript" src="/<MyApp>/jquery-1.4.4.js"></script>

在属性中不允许使用<>字符。您必须转义这些字符,尽管这并不能解决您的问题,因为我不确定<MyApp>来自哪里。


1
我认为他只是在复制粘贴代码后匿名化了应用程序名称 - 但如果他的应用程序确实被称为<MyApp>,那么你是正确的... - Aasmund Eldhuset
我只是在匿名化路径。我应该直接放置MyApp。 - sldahlin
@RequestMapping被错误地设置为“/*”,因此如果找不到javascript文件jquery和json,它将读取主页面作为返回结果,这当然不是正确的格式。感谢您的回复。 - sldahlin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接