@SuppressWarnings("unchecked")
public String upload() throws IOException {
FacesContext fc = FacesContext.getCurrentInstance();
VariableResolver vr = fc.getApplication().getVariableResolver();
DcWebImage wi = (DcWebImage) vr.resolveVariable(fc, "image");
byte[] b = uploadedFile.getBytes();
DcWebObject wo = (DcWebObject) vr.resolveVariable(fc, "webObject");
DcObject dco = wo.getDcObject();
dco.setValue(wi.getFieldIdx(), new DcImageIcon(b));
try {
dco.saveUpdate(false);
wi.setPicture((Picture) dco.getValue(wi.getFieldIdx()));
wo.load();
DcWebObjects objects = (DcWebObjects) vr.resolveVariable(fc, "webObjects");
objects.update(wo);