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)));
      }
    }
  }
}

@@ -1074,84 +1074,8 @@
 ) %7B%0A
-      SearchParams params = getModelObject();%0A      if (params != null) %7B%0A  
     
@@ -1134,26 +1134,28 @@
 ver(
-params)));%0A      %7D
+getModelObject())));
 %0A   

Remove check for null params in onSubmit