title: Wicket: Mapping a type safe page constructor to a readable URL
body: <p>I use Wicket 6.1 and I am trying to figure out how to make my page flows have nicer, more bookmarkable URL's.</p>
  
  <p>I use type safe constructors a lot, so my code will typically look like this:</p>
  
  <pre><code>class SearchResultsPage extends WebPage {
    public SearchResultsPage(SearchResultsModel model) {
       // display the data in the model
    }
  }
  </code></pre>
  
  <p>To navigate to the page I have code like this:</p>
  
  <pre><code>AjaxButton ajaxButton = new IndicatingAjaxButton("ajaxbutton") {
      @Override
      protected void onSubmit(AjaxRequestTarget target, Form&lt;?&gt; form) {
          SearchResultsModel results = search(kriteriamodel)                
          getRequestCycle().setResponsePage(new SearchResultsPage(results));
      }
  
      @Override
      protected void onError(AjaxRequestTarget target, Form&lt;?&gt; form) {
          target.add(feedback);
      }
  };
  </code></pre>
  
  <p>Now when I reach the result page, my URL will look something like searchresults?5</p>
  
  <p>I would like to be able to encode the search-parameters into a URL that the user could bookmark for later referal.</p>
  
  <p>I am aware that I can use the PageParameters map and manually map my objects to and from that structure. But I am looking for a more <em>elegant</em> solution.</p>
  
  <ul>
  <li>I am looking for pointers to some clever interface, that my page or
  model should implement, to make the page more bookmarkable. </li>
  <li>An example would be nice too.</li>
  <li>Ideally only code in the Page/Model should be changed.</li>
  </ul>
  
  <p>Thanks.</p>