在JSF2.0项目中使用PrimeFaces 2.2.RC2。
我正在尝试用gmap组件来呈现一个基本的Google。没有错误,只显示空白页,地图应该在哪里。
我的.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>
没有任何问题,使其他PrimeFaces组件呈现在这个项目和示例在PrimeFaces网站上呈现在我的浏览器刚刚好。
有什么想法吗?
更新:
我将视图标记更改为<f:view contentType="text/html">
,现在我得到了地图应该在的灰色框,当我悬停在该框上时,馆长转向白手抓取并移动地图,但仍然没有地图显示。
发布于 2011-01-21 12:49:29
需要<f:view contentType="text/html">
才能在Safari/Chrome中工作
我的另一个问题是混合词拼错了,下面的作品是:
<h1>Google Map 1</h1>
<p:gmap center="41.381542, 2.122893" zoom="15" type="HYBRID"
style="width:600px;height:400px" />
拼写从来不是我的强项。
发布于 2012-01-07 17:36:27
您需要将此脚本添加到页面中:
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript" ></script>
发布于 2013-05-28 00:02:13
这个对我有用
<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="HYBRID" style="width:600px;height:400px" />
</f:view>
</h:body>
https://stackoverflow.com/questions/4754708
复制相似问题