I want to show some data inside infoWindow of Gmap. the code is as follow:
<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>
and My ManagedBean
public void onMarkerSelect(OverlaySelectEvent event) {
marker = (Marker) event.getOverlay();
markerAll = (myHelperClass) marker.getData();
}
Everything is working fine in development on my local computer. When the marker is clicked, the data (address) shows up in the infoWindow.
On production I see a lot of ClassCastException
like:
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)
...
...
The property data
of the org.primefaces.model.map.Marker
is of type Object
and not String
!
What am I doing wrong? And why this works sometime and sometimes not?
I'm using Primefaces 5.3.7
I think it's missing the uppercase letter m - myHelperClass by MyHelperClass
public void onMarkerSelect(OverlaySelectEvent event) {
marker = (Marker) event.getOverlay();
markerAll = (MyHelperClass) marker.getData();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.