Kalle1985
14 Oct 2009, 7:02 AM
Hi,
i want to read out the value of the my comboBox @ server side.
When i try to get the value of the selected comboBox, i just get the "label".
But i need the "value" !!!
Here the snippet of client-code:
public ComboBox<KeyValueModel> getComboBox() {
if(combo == null) {
combo = new ComboBox<KeyValueModel>();
combo.setEditable(false);
combo.setAllowBlank(false);
combo.setName("comboBox");
combo.setEmptyText("Waehlen Sie den Parametertyp...");
ListStore<KeyValueModel> store = new ListStore<KeyValueModel>();
store.add(new KeyValueModel("aaa", "3"));
store.add(new KeyValueModel("bbb", "2"));
store.add(new KeyValueModel("ccc", "1"));
combo.setStore(store);
combo.setFieldLabel("Parameterart ");
combo.setValueField(KeyValueModel.VALUE);
combo.setDisplayField(KeyValueModel.LABEL);
combo.addSelectionChangedListener(new SelectionChangedListener<KeyValueModel>() {
@Override
public void selectionChanged(SelectionChangedEvent<KeyValueModel> se) {
checkFields();
}
});
}
return combo;
}
Here where i try to get the "value" of the selected field (comboBox) in the "doPost" method @ my extended class of HttpServlet:
while(it.hasNext()) {
FileItem item = (FileItem) it.next();
if(item.getFieldName().equals("fileUpload")) {
if (!item.isFormField()) {
String dateinameMitTyp = item.getName().substring(item.getName().lastIndexOf("\\"));
String dateiname = dateinameMitTyp.substring(1, dateinameMitTyp.indexOf("."));
GregorianCalendar gc = new GregorianCalendar();
File uploadedFile = new File("D:\\paramUpload\\"
+ dateiname + "_"
+ uid + "_"
+ gc.getTimeInMillis()
+ dateinameMitTyp.substring(dateinameMitTyp.indexOf(".")));
item.write(uploadedFile);
}
} else if(item.getFieldName().equals("comboBox")) {
if(item.isFormField()) {
//WHAT SHOULD I DO HERE?
System.out.println(value);
}
}
}
I send the data via POST in my FormPanel(). (formpanel.submit())...
I want to get the "3", not the "aaa"...
Does anyone know a solution?
i want to read out the value of the my comboBox @ server side.
When i try to get the value of the selected comboBox, i just get the "label".
But i need the "value" !!!
Here the snippet of client-code:
public ComboBox<KeyValueModel> getComboBox() {
if(combo == null) {
combo = new ComboBox<KeyValueModel>();
combo.setEditable(false);
combo.setAllowBlank(false);
combo.setName("comboBox");
combo.setEmptyText("Waehlen Sie den Parametertyp...");
ListStore<KeyValueModel> store = new ListStore<KeyValueModel>();
store.add(new KeyValueModel("aaa", "3"));
store.add(new KeyValueModel("bbb", "2"));
store.add(new KeyValueModel("ccc", "1"));
combo.setStore(store);
combo.setFieldLabel("Parameterart ");
combo.setValueField(KeyValueModel.VALUE);
combo.setDisplayField(KeyValueModel.LABEL);
combo.addSelectionChangedListener(new SelectionChangedListener<KeyValueModel>() {
@Override
public void selectionChanged(SelectionChangedEvent<KeyValueModel> se) {
checkFields();
}
});
}
return combo;
}
Here where i try to get the "value" of the selected field (comboBox) in the "doPost" method @ my extended class of HttpServlet:
while(it.hasNext()) {
FileItem item = (FileItem) it.next();
if(item.getFieldName().equals("fileUpload")) {
if (!item.isFormField()) {
String dateinameMitTyp = item.getName().substring(item.getName().lastIndexOf("\\"));
String dateiname = dateinameMitTyp.substring(1, dateinameMitTyp.indexOf("."));
GregorianCalendar gc = new GregorianCalendar();
File uploadedFile = new File("D:\\paramUpload\\"
+ dateiname + "_"
+ uid + "_"
+ gc.getTimeInMillis()
+ dateinameMitTyp.substring(dateinameMitTyp.indexOf(".")));
item.write(uploadedFile);
}
} else if(item.getFieldName().equals("comboBox")) {
if(item.isFormField()) {
//WHAT SHOULD I DO HERE?
System.out.println(value);
}
}
}
I send the data via POST in my FormPanel(). (formpanel.submit())...
I want to get the "3", not the "aaa"...
Does anyone know a solution?