在 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 显示。最佳答案
您需要将此脚本添加到您的页面:
<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/