Errors : Wicket RuntimeException “No get method defined for class–upload”

In a recent Wicket migration 1.3 to 1.6, my application was giving me trouble whenever used uploads an image.

Main exception

org.apache.wicket.WicketRuntimeException: No get method defined for class: class com.ptc.fusion.web.pages.admin.ManageCustomizationPage expression: upload
     at org.apache.wicket.core.util.lang.PropertyResolver.getGetAndSetter(
     at org.apache.wicket.core.util.lang.PropertyResolver.getObjectAndGetSetter(
     at org.apache.wicket.core.util.lang.PropertyResolver.getObjectAndGetSetter(
     at org.apache.wicket.core.util.lang.PropertyResolver.getValue(
     at org.apache.wicket.model.AbstractPropertyModel.getObject(
     at org.apache.wicket.Component.getDefaultModelObject(


I spent several hours on this issue, and once again, I figured it out 20 minutes after I posted to SO about it. The fix is to turn the upload field declaration into one that provides a model, like this:

fuf = new FileUploadField("DocumentUpload", new Model<FileUpload>());

EDIT: It turns out this was related to 1.3 -> 1.4 migration. Per the migration guide,

FileUploadField – now requires model

The FileUploadField now REQUIRES a model. This means that if you previously used the ID-only >constructor (i.e. new FileUploadField(“myFileField”)), you will need to change it to include >a model (i.e. new FileUploadField(“myFileField”, new Model())).


Previously constructor was like :

final FileUploadField uploadField = new FileUploadField(“upload”);


The problem got resolved just by using the new constructor mentioned below :

        IModel uploadModel = new Model<FileUpload>();

    public IModel getUploadModel() {
        return uploadModel;

    public void setUploadModel(IModel uploadModel) {
        this.uploadModel = uploadModel;
    final FileUploadField uploadField = new FileUploadField(“upload”, uploadModel);


I found solution here :

Wicket: ListView skipping an item

The question is : is it possible to skip an item in populateItem() ?

If try skipping it by adding the item.add() using if statement (conditionally) an error would be thrown. so it is not straight forward. There is a way, trick or workaround.

Just add an empty panel (with false visibility), where ever you want to skip the item based on  condition.


Wicket – refreshing ListView triggered automatically after some time

WebMarkupContainer.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5))); 

adding this behaviour directly to list view might not work. So the trick is to add list view in the WebMarkupContainer and apply ajax self updating time behaviour to that in a loop with the duration mentioned.


listContainer = new WebMarkupContainer(“listContainer”);
listContainer.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(20)));

rowOrderListView = new OrderListView(“orderRow”, orderDataProvider);


Wicket : capturing onchange event of a drop down

DropDownChoice statusDropDown = new DropDownChoice(“orderStatus”, new  PropertyModel(orderDataProvider,
“statusFilter”), statuses, new ChoiceRenderer() {
private static final long serialVersionUID = 1L;

public Object getDisplayValue(Object object) {
if (OrderDataProvider.PENDING.equals(object)) {
return getString(“viewExistingOrdersPage.orderTable.column.state.created.label”);
} else {
return getString(“viewExistingOrdersPage.orderTable.column.state.all.label”);


  statusDropDown.add(new AjaxFormSubmitBehavior(“onChange”) {
private static final long serialVersionUID = 1L;

protected void onSubmit(AjaxRequestTarget target) {
System.out.println(“do your stuff here “);

protected void onError(AjaxRequestTarget target) {


wicket : Drag and Drop

Latest wicket support drag n drop English: Drag and Drop Ltd Logo
here is the link

here is the same code, simple define source and target 🙂

        WebMarkupContainer container = new WebMarkupContainer("container");
    Model<String> model = Model.of(new String("AAA"));
    container.add(new DragSource(Operation.values()) {
          public void onAfterDrop(AjaxRequestTarget target, Transfer transfer) {

              System.out.println("Drag n drop");


    container.add(new DropTarget(Operation.values()) {
          public void onDrop(AjaxRequestTarget target, Transfer transfer, Location location) {
            // add transfer data


    Label label = new Label("aaa", model);


What is the need to call setOutputMarkupId(true) in wicket components ?

When use Ajax with wicket you have to set the the component to output it’s markup id or else wicket framework complains about not having it set.
Only the targets needs the setOutputMarkupId(true). So if the component is Ajax driven than only setOutputMarkupId(true) is required.

Example: here this view will get populated by using ajax call back function.

WebMarkupContainer   view = new WebMarkupContainer(“view”);


Wicket Markup Inheritance

Markup Inheritance lets a Component extend the markup of its super class. The subclass markup is inserted at one point in the super class markup.

Let’s see an example:
public class Parent extends Component {}


… parent content …
… parent content …


… child content …
public class Child extends Parent {}
Renders as:

… parent content …
… child content …
… parent content …

It is just like having a Panel defined in your Component class markup, and let subclasses add the Panel. But it doesn’t need an extra Component and is much easier to use. Markup Inheritance is also a convenient replacement for most Border components.

Markup Inheritance works with WebPages, so you can easily use the same header and footer on several pages.