Javafx 2 如何将mybatis的结果映射绑定到javafx combobox?
我有现有的java mybatis应用程序。我已经用combobox创建了javafx场景。Combox显示了ObservableList的值列表。我修改了DAO类以返回ObservableList。 但它抛出运行时异常,因为mybatis返回一个列表。Javafx 2 如何将mybatis的结果映射绑定到javafx combobox?,javafx-2,mybatis,Javafx 2,Mybatis,我有现有的java mybatis应用程序。我已经用combobox创建了javafx场景。Combox显示了ObservableList的值列表。我修改了DAO类以返回ObservableList。 但它抛出运行时异常,因为mybatis返回一个列表。 线程“main”org.apache.ibatis.reflection.ReflectionException中出现异常:使用无效类型()或值()实例化接口javafx.collections.observeList时出错。原因:java.l
线程“main”org.apache.ibatis.reflection.ReflectionException中出现异常:使用无效类型()或值()实例化接口javafx.collections.observeList时出错。原因:java.lang.NoSuchMethodException:javafx.collections.ObservableList。() 我将下面的代码转换成mybatis resultmap到ObservableList。JavaFX组合框由值填充
Gates mapper = session.getMapper(Gates.class);
List<GateVO> gateVOs = mapper.getGates();
ObservableList<String> gates = FXCollections.observableArrayList();
if (gateVOs != null && !gateVOs.isEmpty()) {
for (GateVO gateVO : gateVOs) {
gates.add(gateVO.getGateNo());
}
}
gatesmapper=session.getMapper(Gates.class);
List gateVOs=mapper.getGates();
ObservableList gates=FXCollections.observableArrayList();
if(gateVOs!=null&&!gateVOs.isEmpty()){
用于(GateVO GateVO:gateVOs){
add(gateVO.getGateNo());
}
}
我们不能直接使用mybatis结果绑定javafx控件吗?
有其他方法吗?你试过了吗
ObservableList<GateVO> gates = FXCollections.observableArrayList(gateVOs);
observeListGates=FXCollections.observearraylist(gateVOs);