Hello fellow Wicket users,
I am getting a
org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
Unable to serialize class:
org.apache.wicket.util.io.DeferredFileOutputStream exception when I
added a file upload feature to my AddProductForm.
My form is serialiazable yet I don't which of its child components are
not serializable. Can anyone shed any light on this?
Cheers,
James.
Here is my Page class:
public class AddProductPage extends AdminPage {
private static final long serialVersionUID = 1L;
@SpringBean(name="adminService")
private AdminService adminService;
public AddProductPage(Product product) {
MenuBorder border = new MenuBorder("libBorder");
border.add(new FeedbackPanel("feedback"));
border.add(new AddProductForm("productForm", product));
add(border);
}
private final class AddProductForm extends Form {
private static final long serialVersionUID = 1L;
private FileUploadField fileUploadField;
public AddProductForm(String id, Product product) {
super(id, new CompoundPropertyModel(product));
setMultiPart(true);
add(new RequiredTextField("name"));
add(new RequiredTextArea("description"));
add(new RequiredTextField("sellValue",
BigDecimal.class));
add(new RequiredTextField("units", Long.class));
add(new CheckBox("onSell"));
add(new DropDownChoice("category",
catalogService.getCategories()));
add(new DropDownChoice("manufacturer",
catalogService.getManufacturers()));
add(fileUploadField = new FileUploadField("fileInput",
new
Model(fileUploadField)));
setMaxSize(Bytes.megabytes(100));
}
@Override
protected void onSubmit() {
final FileUpload upload =
fileUploadField.getFileUpload();
if (upload != null)
System.out.println("File is not empty! Whoo
hooo!");
else
System.out.println("File is empty! Whoo hooo!");
fileUploadField.detachModels();
/**Product product = (Product) getModelObject();
product.setEntryDate(new
Timestamp(System.currentTimeMillis()));
product.setImageURL("uploads/");
System.out.println(product.getCategory());
adminService.saveProduct(product);
setResponsePage(ViewProductsPage.class);**/
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]