GMap doesn't work after project porting from PF 3.4 to 5.0

UI Components for JSF
Post Reply
n3tmaster
Posts: 14
Joined: 29 Nov 2013, 16:35

29 Aug 2014, 18:29

Hi guys,
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

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

03 Sep 2014, 21:21

1. run your app using primefaces 3.4, and look at the resources (javascript files) loaded in your browser when the page renders in your browser

2. repeat step #1 above with primefaces 5.0

3. you may have a primefaces javascript file that is not being loaded and not running onload, after page is rendered in your browser

4. check your developer/debug console for any javascript errors in your browser after (primefaces 5.0) xhtml page is rendered in your browser
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

n3tmaster
Posts: 14
Joined: 29 Nov 2013, 16:35

24 May 2015, 02:12

Oh man, this is an oldest post. I'm sorry if I didn't reply.

But thank you so much for your answer!

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 30 guests