2016-07-23 71 views
0

我primefaces 6.0使用GMAP有問題,我嘗試使用這個URL裏面primefaces例如www.primefaces.org/showcase/ui/data/gmap/markers.xhtmlPrimeFaces GMAP標籤忽略模型issuse

我的代碼正是在地圖上相同,但沒有顯示

<script type="text/javascript" 
src="https://maps.googleapis.com/maps/api/js?key=myapikey"> 


@ManagedBean 
public class MarkersView implements Serializable { 

/** 
* 
*/ 
private static final long serialVersionUID = 1L; 
private MapModel simpleModel; 

@PostConstruct 
public void init() { 
    simpleModel = new DefaultMapModel(); 

    //Shared coordinates 
    LatLng coord1 = new LatLng(36.879466, 30.667648); 
    LatLng coord2 = new LatLng(36.883707, 30.689216); 
    LatLng coord3 = new LatLng(36.879703, 30.706707); 
    LatLng coord4 = new LatLng(36.885233, 30.702323); 

    //Basic marker 
    simpleModel.addOverlay(new Marker(coord1, "Konyaalti", "http://maps.google.com/mapfiles/ms/micons/blue-dot.png")); 
    simpleModel.addOverlay(new Marker(coord2, "Ataturk Parki")); 
    simpleModel.addOverlay(new Marker(coord3, "Karaalioglu Parki", "http://maps.google.com/mapfiles/ms/micons/blue-dot.png")); 
    simpleModel.addOverlay(new Marker(coord4, "Kaleici", "http://maps.google.com/mapfiles/ms/micons/blue-dot.png")); 
} 

public MapModel getSimpleModel() { 
    return simpleModel; 
} 
} 

我也嘗試添加多段線,多邊形,圓形,矩形...等,但沒有顯示在地圖上 我測試如按鈕,輸入其它組件,grwl..etc一切工作正常使用EJB 唯一的問題與GMAP模型

我不知道是否是錯誤與primefaces

+0

你是否也有相同的標記與示例中相同的座標? – Apostolos

+0

是的一切都一樣 – hasd11

回答

0

誒找到解決辦法,但仍我不明白爲什麼?

我改變我的代碼

@ManagedBean 
public class MarkersView implements Serializable { 

/** 
* 
*/ 
private static final long serialVersionUID = 1L; 
private MapModel simpleModel; 


public MarkersView() { 
    simpleModel = new DefaultMapModel(); 

    //Shared coordinates 
    LatLng coord1 = new LatLng(36.879466, 30.667648); 
    LatLng coord2 = new LatLng(36.883707, 30.689216); 
    LatLng coord3 = new LatLng(36.879703, 30.706707); 
    LatLng coord4 = new LatLng(36.885233, 30.702323); 

    //Basic marker 
    simpleModel.addOverlay(new Marker(coord1, "Konyaalti", "http://maps.google.com/mapfiles/ms/micons/blue-dot.png")); 
    simpleModel.addOverlay(new Marker(coord2, "Ataturk Parki", "http://maps.google.com/mapfiles/ms/micons/yellow-dot.png")); 
    simpleModel.addOverlay(new Marker(coord3, "Karaalioglu Parki", "http://maps.google.com/mapfiles/ms/micons/blue-dot.png")); 
    simpleModel.addOverlay(new Marker(coord4, "Kaleici", "http://maps.google.com/mapfiles/ms/micons/blue-dot.png")); 
} 



public MapModel getSimpleModel() { 
    return simpleModel; 
} 
} 

它的做工精細的顯示標記,但並沒有改變從URL 任何標記一下明白爲什麼這個代碼的工作,第一沒有?