我正在使用jDeveloper 12.1.3和MAF 2.0.0.0。我试图在移动应用程序中构建设置页面。所有项目都基于移动设备上的本地SQLite数据库。我已经设置了POJO(getter和setter)和DC类,初始化了.sql和connectionfactory.java文件。这是我的问题:
每次检查其中一个复选框时,页面都会刷新并清除页面上的所有内容。我没有任何与任何复选框相关联的valueChangeListener。
我对ADF和MAF非常陌生,所以我认为我错过了一些简单的事情。提前感谢您提出问题/意见/疑虑。
以下是相关代码:
项目本身的XML:
<amx:selectBooleanCheckbox value="#{bindings.requireTagAndStateOrVin.inputValue}"
label="#{bindings.requireTagAndStateOrVin.label}" id="sbc1"/>
Java: `public void setRequireTagAndStateOrVin(String requireTagAndStateOrVin){ this.requireTagAndStateOrVin = requireTagAndStateOrVin; }
public String getRequireTagAndStateOrVin() {
return requireTagAndStateOrVin;
}`
来自SettingsDC类的Java
`public class SettingsDC { private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
public SettingsDC() {
super();
}
public Settings[] getSettings(){
Settings[] settings = null;
settings = getSettingsFromDB();
return settings;
}
private Settings[] getSettingsFromDB(){
Connection conn = null;
List returnValue = new ArrayList();
try {
conn = ConnectionFactory.getConnection();
Statement stmt = conn.createStatement();
ResultSet result = stmt.executeQuery("SELECT * FROM MY_TABLE;");
while (result.next()){
settings.setRequireTagAndStateOrVin(result.getString("REQUIRE_TAG_AND_STATE_OR_VIN_IND"));
returnValue.add(settings);
}
} catch (Exception ex){
Utility.ApplicationLogger.severe(ex.getMessage());
ex.printStackTrace();
throw new RuntimeException(ex);
}
Collections.sort(returnValue);
return (Settings[]) returnValue.toArray(new Settings[returnValue.size()]);
}
public void addPropertyChangeListener(PropertyChangeListener l)
{
propertyChangeSupport.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l)
{
propertyChangeSupport.removePropertyChangeListener(l);
}
}`