【问题标题】:Using & in URL causes XML error: The reference to entity "foo" must end with the ';' delimiter在 URL 中使用 & 会导致 XML 错误:对实体“foo”的引用必须以“;”结尾分隔符
【发布时间】:2012-01-31 16:29:20
【问题描述】:

我正在尝试使用以下代码获取谷歌地图图像:

<img src="http://maps.googleapis.com/maps/api/staticmap?center=#{profile.latitude},#{profile.longitude}&zoom=14&size=400x400&sensor=false"/>

但我的浏览器出现异常提示:

解析/content/profile.xhtml时出错:
错误跟踪 [行:48] 对实体“缩放”的引用必须以“;”结尾分隔符。

如何避免将 URL 中的 &amp; 解释为 XML?

【问题讨论】:

    标签: jsf entity facelets ampersand


    【解决方案1】:

    &amp;amp; 替换为 &amp;amp;,因为标记被解析为 XML,&amp;zoom 被解析为 XML 中不存在的 HTML 实体。

    【讨论】:

      猜你喜欢
      • 2011-09-22
      • 2019-10-04
      • 2011-07-05
      • 2014-05-26
      • 2010-12-29
      • 2020-07-14
      • 1970-01-01
      • 2017-02-02
      相关资源
      最近更新 更多