jsf - PrimeFaces gmap won't show -
i using primafaces gmap display map, have tried simplest possible solution. have taken key google , wrote code this:
<h:head> <script src="https://maps.googleapis.com/maps/api/js?key=aizasyasp910hdk6ge2oeqqcemmsl5be2srrvii" type="text/javascript"></script> <title>admin</title> </h:head> <h:body> <div> <p:gmap center="41.381542, 2.122893" zoom="15" type="hybrid" style="width:100%;height:400px" /> </div> ...... i have tried multiples keys, have tried async, defer, ?sensor=false... nothing seems work, map won't show.
the problem happening because did not include google map script in <head> tag. primefaces showcase should warn users this...
include following script in <head> tag:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> important: if using localhost, map still not work. must either use ip (can 127.0.0.1, example) or host application in cloud.
important²: since 2016 google maps require api key work properly, can read more here.
Comments
Post a Comment