title: Search form submission and pagination in Scala Play 2.0 Framework
body: <p>I am making a site with basic search functionality.  Queries contain a bit of information, so I have a <code>case class Query</code> to contain the search information.  There may be a lot of results, so I need to support pagination.</p>
  
  <p>Here is the method that handles form submission.  I use GET so the page is bookmarkable.</p>
  
  <pre><code>  GET  /search   controllers.Application.submit
  
    def submit = Action { implicit request =&gt;
      searchForm.bindFromRequest.fold(
        errors =&gt; BadRequest(views.html.index(errors)),
        query =&gt; doSearch(query, 0))
    }
  </code></pre>
  
  <p>The problem comes when I want to support pagination.  I would prefer that the URL does not change and only a <code>&amp;page=i</code> parameter is added.  However, I probably don't want to go back through the <code>submit</code> action on the controller (but maybe I'm wrong here).</p>
  
  <p>How can I provide this?  If I have a seperate route for pagination, can I pass <code>Query</code> objects or do I need to break apart all the parameters?</p>
  
  <p>My thought is that my pagination link will go to a URL similar to this:</p>
  
  <pre><code>@{Application.search(query, pageNo)}
  </code></pre>
  
  <p>Of course, I can't just submit this to my form submission action because it expects a <code>play.api.mvc.Request[play.api.mvc.AnyContent]</code>.</p>