scala - Lift - 页面在 Firefox 中显示为 XML 而不是 HTML

标签 scala lift

我正在尝试运行一个简单的 Lift 示例,但遇到了一个奇怪的问题。我正在使用 Sonatype 示例列表项目 here .我稍微修改了 HTML,但它最初也不起作用。我遇到的问题是,当我运行本地码头服务器并尝试访问 http://localhost:8080 时它在 Firefox 3.6.10 中显示为 XML 而不是 HTML。请注意,它在 IE8 中显示正常,但 IE8 中的 Content-Type 是“text/html”。我认为 Firefox 出于某种原因不喜欢内容类型“application/xhtml+xml”。 Firefox 中的消息说:

This XML file does not appear to have any style information associated with it. The document tree is shown below.



下面是来自 Firebug 的响应头:
Expires Thu, 16 Sep 2010 03:55:04 UTC
Content-Length  558
Cache-Control   no-cache; private; no-store
Content-Type    application/xhtml+xml; charset=utf-8
Pragma  no-cache
Date    Thu, 16 Sep 2010 03:55:04 UTC
X-Lift-Version  2.0-scala280-SNAPSHOT
Server  Jetty(6.1.22)

..和实际 react :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>Lift Test</title>    
</head>
<body>
  <h2>Welcome to your project!</h2>
    <p>  
      <span>Welcome to toto01 at Wed Sep 15 20:55:04 PDT 2010</span>
    </p>
    <script type="text/javascript" src="/ajax_request/liftAjax.js"></script>    
    <script type="text/javascript">
      // <![CDATA[   
      var lift_page = "F586508075515C1K";
      // ]]>
   </script>
</body>
</html> 

关于出了什么问题的任何想法?如果这是问题,我将如何更改 Lift for Firefox 中的 Content-Type?

最佳答案

好的,看起来问题与没有 xmlns 属性的元素有关。将 XHTML 更改为以下内容后,内容类型为“application/xhtml+xml”时效果很好:

<html xmlns="http://www.w3.org/1999/xhtml">

关于scala - Lift - 页面在 Firefox 中显示为 XML 而不是 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3723614/

相关文章:

scala - Akka actorSelection 失败后重新连接

java - 在 Play 2.5.x 中找不到类 play.api.cache.CacheApi 的构造函数

scala - Lift 中 MegaProtoUser 的替代方案

api - 提升 REST 服务无法识别 PUT 请求

javascript - Lift:如何将数据从 JavaScript 传回服务器

javascript - 比较 javascript 元素和 scala 变量的 Play 框架 Twirl 模板

scala - 理解 Scala 中的 "type arguments do not conform to type parameter bounds"错误

templates - 如何循环遍历 scala 模板中的 flash 元素?

jquery - 使用 jquery 函数在 lift 框架片段中显示 div

java - 电梯不喜欢我的 Web.xml