Hello,
I'm getting my knickers in a twist with getting data from a form combobox field.
The combobox is loaded with data from a remote source and displays properly. However, when I want to access the selected value I am getting this exception,
java.lang.ClassCastException: uk.co.moonsit.eai.console.data.BeanModel_uk_co_moonsit_eai_console_data_AppSystemType cannot be cast to uk.co.moonsit.eai.console.data.AppSystemType
Any idea what I am doing wrong?
Here's the code:
Regards,Code:this.btnAdd = new Button("Add"); this.btnAdd.addSelectionListener(new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { log("Add system"); Field name = (Field) frmpnlAddSystem.getItem(0); String n = (String) name.getValue(); log(n); Field type = (Field) frmpnlAddSystem.getItem(1); String t = null; try { AppSystemType st = (AppSystemType) type.getValue(); t = st.getType(); log(t); } catch (ClassCastException e) { log(e.toString()); t = "error"; }
Rupert