diff --git a/src/main/java/info/bukova/isspst/ui/BindingForm.java b/src/main/java/info/bukova/isspst/ui/BindingForm.java index b380fd5b..2c84623b 100644 --- a/src/main/java/info/bukova/isspst/ui/BindingForm.java +++ b/src/main/java/info/bukova/isspst/ui/BindingForm.java @@ -2,7 +2,7 @@ package info.bukova.isspst.ui; import java.lang.reflect.InvocationTargetException; -import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.beanutils.PropertyUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.zkoss.bind.SimpleForm; @@ -34,12 +34,32 @@ public class BindingForm extends SimpleForm { */ public void bindTo(T object) { for (String key : getFieldNames()) { - try { - BeanUtils.setProperty(object, key, getField(key)); - } catch (IllegalAccessException e) { + // try { + // BeanUtils.setProperty(object, key, getField(key)); + // + // } catch (IllegalAccessException e) { + // logger.warn("Cannot bind value", e); + // } catch (InvocationTargetException e) { + // logger.warn("Cannot bind value", e); + // } + try + { + PropertyUtils.setProperty(object, key, getField(key)); + } + catch (NoSuchMethodException e) + { + logger.warn("Cannot bind value " + key + " (" + e.getMessage() + ")"); + // e.printStackTrace(); + } + catch (IllegalAccessException e) + { logger.warn("Cannot bind value", e); - } catch (InvocationTargetException e) { + e.printStackTrace(); + } + catch (InvocationTargetException e) + { logger.warn("Cannot bind value", e); + e.printStackTrace(); } } } diff --git a/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderForm.java b/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderForm.java index 4d013a57..b374199a 100644 --- a/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderForm.java +++ b/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderForm.java @@ -194,6 +194,7 @@ public class OrderForm extends FormViewModel @NotifyChange("dataBean") public void doFillSuppAddress() { + this.getDataForm().bind(); AddressEmb addr; if (this.selectedSuppAddrItem == null) @@ -215,6 +216,7 @@ public class OrderForm extends FormViewModel @NotifyChange("dataBean") public void doFillDeliveryAddress() { + this.getDataForm().bind(); AddressEmb addr; if (this.selectedDeliveryAddrItem == null) diff --git a/src/main/webapp/main/orders/created/orderForm.zul b/src/main/webapp/main/orders/created/orderForm.zul index e8c1c874..f11d9b9d 100644 --- a/src/main/webapp/main/orders/created/orderForm.zul +++ b/src/main/webapp/main/orders/created/orderForm.zul @@ -18,7 +18,7 @@ label="${labels.Order}" />