package com.grailbox.twicket;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.StatelessForm;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.validation.validator.StringValidator.MinimumLengthValidator;

public class SearchPanel extends Panel {
  private static final long serialVersionUID = -8610733111417498232L;

  public SearchPanel(String id) {
    super(id);
    add(new SearchForm("searchForm"));
  }

  private class SearchForm extends StatelessForm<SearchParams> {
    private static final long serialVersionUID = -5253297831508495384L;

    private SearchForm(final String id) {
      super(id);
      setModel(new CompoundPropertyModel<SearchParams>(new SearchParams()));
      add(new Label("searchLabel", "Search Terms:"));
      add(new TextField<String>("searchString").setRequired(true).add(new MinimumLengthValidator(3)));
    }

    @Override
    protected final void onSubmit() {
      SearchParams params = getModelObject();
      if (params != null) {
        setResponsePage(new HomePage(new SearchTweetRetriever(params)));
      }
    }
  }
}

package com.grailbox.twicket;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.StatelessForm;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.validation.validator.StringValidator.MinimumLengthValidator;

public class SearchPanel extends Panel {
  private static final long serialVersionUID = -8610733111417498232L;

  public SearchPanel(String id) {
    super(id);
    add(new SearchForm("searchForm"));
  }

  private class SearchForm extends StatelessForm<SearchParams> {
    private static final long serialVersionUID = -5253297831508495384L;

    private SearchForm(final String id) {
      super(id);
      setModel(new CompoundPropertyModel<SearchParams>(new SearchParams()));
      add(new Label("searchLabel", "Search Terms:"));
      add(new TextField<String>("searchString").setRequired(true).add(new MinimumLengthValidator(3)));
    }

    @Override
    protected final void onSubmit() {
      setResponsePage(new HomePage(new SearchTweetRetriever(getModelObject())));
    }
  }
}

Remove check for null params in onSubmit
Remove check for null params in onSubmit
