This package contains the DefaultEventListenerBean. When electing to use beans to handle map events, developers should create a subclass of DefaultEventListenerServlet and generate the needed <jsp:useBean> tag on the page containing the map. They should then provide the either the current page path or "" as the url attribute in any <googlemaps:event> tags.

When subclassing DefaultEventListenerBean, developers should only override the processXX methods, calling super.processXX(), then providing additional functionality afterwards. This ensures the map will have consistent, normal map behaviour, in addition to their custom behaviour.

The following example is a JavaBean based event listener that will add a marker to the map whenever the user clicks on it (assumes a <googlemaps:event action="click"> tag was added to the map):

public void MyListenerBean extends DefaultEventListenerBean {

	public void processClickEvent(GoogleMapTag map, double longitude, double latitude) {\
		super.processClickEvent(map, longitude, latitude);
		GoogleMapPointTag point = new GoogleMapPointTag();
		String pointName = "point_" + (new Date()).getTime();
		point.setId(pointName);
		map.addPoint(point);
		GoogleMapMarkerTag marker = new GoogleMapMarkerTag();
		String markerName = "marker_" + (new Date()).getTime();
		marker.setId(markerName);
		marker.setPoint(pointName);
		map.addMarker(marker);
	}
}