这是我的托管 Bean 类,
公共类 MapBean 实现可序列化 {
private MapModel polylineModel;
public MapBean() {
createMap();
}
public void createMap(){
try {
polylineModel = new DefaultMapModel();
LatLng coord;
String query = "select a.lan,a.lat from country;";
Connector conn = new Connector();
Statement str = (Statement) conn.getConn().createStatement();
ResultSet res = str.executeQuery(query);
Polyline polyline1;
polyline1 = new Polyline();
while(res.next()){
coord= new LatLng(Integer.parseInt(res.getString(2)), Integer.parseInt(res.getString(1)));
polyline1.getPaths().add(coord);
}
polyline1.setStrokeWeight(10);
polyline1.setStrokeColor("#FF9900");
polyline1.setStrokeOpacity(0.7);
polylineModel.addOverlay(polyline1);
} catch (SQLException ex) {
Logger.getLogger(MapBean.class.getName()).log(Level.SEVERE, null, ex);
}
}
public MapModel getPolylineModel() {
return polylineModel;
}
public void onPolylineSelect(OverlaySelectEvent event) {
addMessage(new FacesMessage(FacesMessage.SEVERITY_INFO, "Polyline Selected", null));
}
public void addMessage(FacesMessage message) {
FacesContext.getCurrentInstance().addMessage(null, message);
}
但问题是当它被编译时它给出了一个像这样的错误“不能实例化类:org.primefaces.examples.view.MapBean”。是什么原因??