Reputation: 21
I tray to use google map in my application, but i have a problem , i can't load it, i'm using primefaces, I don't know where is the problem
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Home</title>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
</h:head>
<h:body>
<ui:composition template="../template/template_.xhtml">
<ui:define name="content">
<p:gmap center="41.381542, 2.122893" zoom="15" type="HYBRID" style="width:600px;height:400px" />
</ui:define>
</ui:composition>
<h:outputStylesheet library="css" name="primefaces-override.css"/>
</h:body>
</html
>
and this is what i get : ReferenceError: google is not defined ,
{PrimeFaces.cw('GMap','widget_mainForm_j_idt45',{id:'mainForm:j_idt45',mapTypeId:**google**.maps.MapTypeId.HYBRID,center:new **google**.maps.LatLng(41.381542, 2.122893),zoom:15,fitBounds:false});});</script>
Upvotes: 0
Views: 3354
Reputation: 724
When using composition, you have to add the js script:
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
to the template_.xhtml file.
Upvotes: 4