我想在gmap的infowdow中显示一些数据。代码如下:
<p:gmap center="#{mybean.latitude}, #{mybean.longitude}" zoom="15"
type="ROADMAP" model="#{mybean.mymapModel}" >
<p:ajax event="overlaySelect" listener="#{mybean.onMarkerSelect}" />
<p:gmapInfoWindow >
<div class="popup_title prem">Address:</div>
<div class="popup_address">#{mybean.markerAll.street}, #{mybean.markerAll.zipcode} #{mybean.markerAll.city}</div>
</p:gmapInfoWindow>
</p:gmap>
和我的托管
public void onMarkerSelect(OverlaySelectEvent event) {
marker = (Marker) event.getOverlay();
markerAll = (myHelperClass) marker.getData();
}
我本地计算机上的开发过程都很好。单击标记时,数据(地址)显示在Infowdindow中。
在生产上,我看到很多ClassCastException
喜欢:
FullAjaxExceptionHandler: An exception occurred during processing JSF ajax request. Error page '/error.jsf' will be shown.
java.lang.ClassCastException: java.lang.String cannot be cast
to com.mypackage.util.myHelperClass
at com.mypackage.myBean.onMarkerSelect(myBean.java:416)
...
...
org.primefaces.model.map.Marker
的属性data
是类型Object
,而不是String
!
我在做什么错?而且为什么这有时可以工作,有时甚至行不通?
我正在使用PrimeFaces 5.3.7
我认为它缺少大写字母m -myhelperclass by MyHelperClass
public void onMarkerSelect(OverlaySelectEvent event) {
marker = (Marker) event.getOverlay();
markerAll = (MyHelperClass) marker.getData();
}