【问题标题】:PrimeFaces Gmap not rendering (in the simplest example)PrimeFaces Gmap 不渲染(在最简单的例子中)
【发布时间】:2012-11-15 02:41:37
【问题描述】:

我有一个最简单的页面之一,上面有 p:gmap

<?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 xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui">

    <f:view>
        <h:head>
            <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
        </h:head>

        <h:body>
            Map:
            <p:gmap center="49.967109, 8.80198" zoom="15" type="HYBRID" />
        </h:body>
    </f:view>

</html>

但是,这在 Map: 标题下绝对没有显示任何内容。

我意识到脚本连接到某些地方,但没有呈现任何内容。

问:出了什么问题,如何解决?

PS:我正在使用所有版本的 PF 3.x ... 更换它们没有帮助。

【问题讨论】:

    标签: jsf jsf-2 primefaces


    【解决方案1】:

    你缺少高度和宽度:

    <p:gmap center="41.381542, 2.122893" zoom="15" type="HYBRID" style="width:600px;height:400px" />
    

    【讨论】:

    • 我从未见过任何组件 require 某种 CSS... 奇怪。谢谢。
    • ..但您可以在 primefaces-userguide 中找到此信息:Four options are required to place a gmap on a page, these are center, zoom, type and style (p.193)
    • 是的,但是当您查看展示时,它没有说明需要放入 h:head 的 JavaScript。直到我发现我也已经删除了 style 属性。运气不好。
    猜你喜欢
    • 2017-01-01
    • 2011-06-12
    • 1970-01-01
    • 1970-01-01
    • 2014-01-31
    • 1970-01-01
    • 2012-06-20
    • 2019-10-31
    • 2012-07-04
    相关资源
    最近更新 更多