I have a great problem.
I have a project wrote in PrimeFaces 3.4 with JSF 2.1 and JAVA6. I'm implementing the porting from PF 3.4 to PF 5.0
but with PF 5.0 the component GMap doesn't work at all! When I load the page, GMap isn't rendered and it appears totally white.
Firebug says : Google is not defined ...
I report here a piece of my code:
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<f:view
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
contentType="text/html">
<h:head>
<script src="https://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/css/garantesStyles.css" />
<title>My App title</title>
</h:head>
<h:body >
<p:ajaxStatus onstart="PF('statusDialog').show();" onsuccess="PF('statusDialog').hide();"/>
<p:dialog modal="true" widgetVar="statusDialog" header="Attendere..."
draggable="false" closable="false">
<p:graphicImage value="/images/ajaxloadingbar.gif" />
</p:dialog>
<h:form id="formOggettoMappa">
<p:gmap widgetVar="oggettoMappa" id="oggettoMappa" center="#{mapUrbanBean.centerMap}"
zoom="#{mapUrbanBean.zoomFactor}" type="hybrid"
style="width:100%;height:600px" model="#{mapUrbanBean.puntiModel}" >
<p:ajax event="overlaySelect" listener="#{mapUrbanBean.onMarkerSelect}" />
</p:gmap>
</h:form>
Code: Select all
@ManagedBean(name="mapUrbanBean")
@SessionScoped
public class MapBean implements Serializable {
private static final long serialVersionUID = 1L;
private MapModel puntiModel;
private double centerX,centerY,zoomFactor;
private String centerMap;
public MapModel getPuntiModel() {
return puntiModel;
}
public void setPuntiModel(MapModel puntiModel) {
this.puntiModel = puntiModel;
}
public String getCenterMap() {
return centerMap;
}
public void setCenterMap(String centerMap) {
this.centerMap = centerMap;
}
public double getCenterX() {
return centerX;
}
public void setCenterX(double centerX) {
this.centerX = centerX;
}
public double getCenterY() {
return centerY;
}
public void setCenterY(double centerY) {
this.centerY = centerY;
}
public int getZoomFactor() {
return zoomFactor;
}
public void setZoomFactor(int zoomFactor) {
this.zoomFactor = zoomFactor;
}
@PostConstruct
public void init(){
this.data = new Date();
this.data2 = new Date();
popolaUltimiMappa();
// popolaMappa();
}
public void popolaUltimiMappa(){
puntiModel= new DefaultMapModel();
LatLng coord = new LatLng(36.890257,30.707417);
puntiModel.addOverlay(new Marker(coord, "this marker","images/mapimg/"+img_a.get(i)));
this.centerX=36.890257;
this.centerY=30.707417;
this.zoomFactor=13;
this.centerMap= this.centerY+ "," +this.centerX;
}
}
This code works fine with PrimeFaces 3.4 but with PrimeFaces 5.0 it doesn't work.
I tried with Google but I found nothing.
Any idea????
Thank you in advance