google-maps - PrimeFaces gmap 不渲染

标签 google-maps jsf primefaces

在 JSF 2.0 项目中使用 PrimeFaces 2.2.RC2。

我正在尝试使用 gmap 组件来呈现基本的 Google map 。没有错误只显示 map 应该在的空白页面。

我的 .xhtml 文件

<?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:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <h:head>
        <script src="http://maps.google.com/maps/api/js?sensor=false" 
              type="text/javascript"></script>
    </h:head>
    <h:body>
        <f:view contentType="text/html">
            <h1>Google Map</h1>
            <p:gmap center="41.381542, 2.122893" zoom="15" type="HYBIRD"
                    style="width:600px;height:400px" />
        </f:view>
    </h:body>
</html>

在此项目和 example 中渲染其他 PrimeFaces 组件没有任何问题在 PrimeFaces 网站上在我的浏览器中呈现就好了。

有任何想法吗 ?

更新:

我将 View 标签更改为 <f:view contentType="text/html"> ,现在我在 map 应该在的地方得到一个灰色框,当我将鼠标悬停在框上时,光标变成白手以抓取和移动 map ,但仍然没有 map 显示。

alt text

最佳答案

您需要将此脚本添加到您的页面:

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

关于google-maps - PrimeFaces gmap 不渲染,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4754708/

相关文章:

ios - flutter 适用于 iOS 的新版 Google Maps SDK 可用 : 4. 1.0.0

MySQL几何交集产生非相交结果

jsf - 验证失败时添加一般消息

javascript - Google Maps API 放大特定区域

google-maps - 渲染方向时不要更改 map 中心或缩放级别

jsf - 扩展JSF commandLink组件

javascript - <div> 点击时不隐藏?

java - 从支持 bean 导航到外部 URL?

jsf - 如何在支持 bean 中使用 primefaces 通过 accordionPanel 获取事件索引

使用对话框框架的primefaces 对话框没有弹出