title: How to avoid 'Neither BindingResult nor plain target object for bean name 'command' available as request attribute' when searching
body: <p>What I want to do seems very simple, but each configuration I use gives me the following error:</p>
  
  <pre><code>java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'command' available as request attribute
  </code></pre>
  
  <p>I want to pass a string to the controller to search and display attributes of a <code>List</code> of <code>Offices</code> that are found in a new page.  I am unable to even view the officeSearch page in my browser, I get the aforementioned error.</p>
  
  <p>officeSearch.jsp (Should just be a simple form to pass a String to be searched):</p>
  
  <pre><code>&lt;div class="header-divider2"&gt;
      &lt;h4&gt;Search&lt;/h4&gt;
  &lt;/div&gt;
  &lt;div id="content" class="center"&gt;
      &lt;div class="well center square borderless"&gt;
          &lt;h1&gt;Location Search&lt;/h1&gt;
           &lt;div class="visible-md visible-lg well well-search"&gt;
             &lt;form:form method="POST" action="officeSearchResults"&gt;
            &lt;div class="form-group"&gt;
              &lt;form:input path="searchCriteria" type="text" id="searchCriteria" placeholder="Find a location..." /&gt;
            &lt;/div&gt;
            &lt;input type="submit" class="btn btn-default" value="Search" /&gt;
          &lt;/form:form&gt;
          &lt;/div&gt;&lt;!-- visible-md --&gt;
      &lt;/div&gt;&lt;!-- well center square --&gt;
  &lt;/div&gt;&lt;!-- center --&gt;
  </code></pre>
  
  <p>Here's the controller method that should display the search page:</p>
  
  <pre><code>@RequestMapping(value = "/officeSearch", method=RequestMethod.GET) 
  public String showOfficesSearch() {
      return "officeSearch";
  }
  </code></pre>
  
  <p>Here is the jsp that should be displayed after the search is submitted (obviously stubbed for now):</p>
  
  <pre><code>&lt;div class="header-divider2"&gt;
      &lt;h4&gt;Search Results&lt;/h4&gt;
  &lt;/div&gt;
  &lt;div id="content" class="center"&gt;
      &lt;div class="well center square borderless"&gt;
          &lt;h1&gt;Location Search RESULTS&lt;/h1&gt;
      &lt;/div&gt;&lt;!-- well center square --&gt;
  &lt;/div&gt;&lt;!-- center --&gt;
  </code></pre>
  
  <p>Here is the controller method that's meant to display the previous page:</p>
  
  <pre><code>@RequestMapping(value = "/officeSearchResults", method = RequestMethod.POST)
  public ModelAndView search(@ModelAttribute("officeSearchResults") String searchCriteria) {
      List&lt;Office&gt; offices = officeServiceImpl.search(searchCriteria);
  
      return new ModelAndView("officeSearchResults", "command", offices);
  }
  </code></pre>
  
  <p>Please advise on getting this working.  Thanks.</p>